I want to do something that goes "hey, if I have no worklog entries, print a message" in a web request in Jira Automation.
For most fields I have no issues going {{if(exists(issue.assignee),"Exists","Missing")}} and having it work.
However for worklog, it looks like worklogs are setup as such per the API response for a ticket:
worklog:{
startAt: 0,
maxResults: 20,
total: 0,
worklogs: [ ]
}
Worklogs containing more data when work has been logged.
Now, I cant seem to just output {{issue.worklog.total}} even when Total comes back with a value of 1 in the API output for the ticket.
Looking at the documentation here: https://confluence.atlassian.com/automation/jira-smart-values-issues-993924860.html
I would expect that I could use {{issue.worklog.timeSpentSeconds}} to get a value to output, and I can.
My problem is if I want to do {{if(exists(issue.worklog.timeSpentSeconds)),"True","False"}} it always returns false even if I have {{issue.worklog.timeSpentSeconds}} right after it outputting a number.
Maybe exists doesnt work with the data format? I tried {{if(issue.worklog.timeSpentSeconds.isEmpty(),"True","False")}} and this also does not work.
I also tried {{#=}}{{issue.worklog.timeSpentSeconds}} <= 0 {{/}} and this errors out if there is no value for timespent in seconds and it returns true if there is time spent. I am also not quite sure how to nest a math expression like this into an if statement to get the exact output I need.