Automation Lite auto log work help

Michelle Gaul April 10, 2019

Hey,

 

I am using Automation Lite for Jira Cloud and want to create a rule to automatically log work.

I have a custom field (date/time) cf10049 in which agents can set a date for an appointment with a client.

I have another customfield (text) cf10067 in which the agents can log their travel time (in minutes). standard: 0

And another textfield cf10068 in which agents log their work time (at the client's site) in minutes. standard: 0

 

Now, I've set up a rule to log forward travel:

trigger: cf10049 changes

if:  cf10067 !~ "0"

then: log work:

time spent: {{issue.customfield_10067}}m
date started: {{issue.customfield_10049.minusMinutes(issue.customfield_10067)}}
work description: 

Hinweg: {{issue.customfield_10067}}

Logged: {{now.convertToTimeZone("Europe/Paris")}} by {{initiator.displayName}}

 

 

the "date started" function does not work :( and i don't know why.

if I enter: {{issue.customfield_10049.minusMinutes(X)}} with X being a random number set from me. It works just fine.

 

If I let the program show me {{issue.customfield_10067}} it shows me the right value for the field. Now I don't know why I doesn't work in combination.

Can someone please tell me what my mistake is?

 

i used a textfield instead of a number field, because the numbers returned from a number field are double and I need integers. therefore, it should actually work with a textfield.

ps. for the way-back travel it is:

date started: {{issue.customfield_10049.plusMinutes(issue.customfield_10068).plusMinutes(issue.customfield_10067)}}

doesnt work either.. 

 

for the right methods I was searching here: https://docs.automationforjira.com/working-with-issue-data/date-functions.html#manipulating-dates

1 answer

1 accepted

0 votes
Answer accepted
Tomas Gustavsson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2019

Hi, 
i guess nu need to collect the value in your function

date started: {{issue.customfield_10049.minusMinutes(issue.customfield_10067)}}

 so i suggest something similar to this
def myCustomField = customFieldManager.getCustomFieldObject("customfield_10067")
myCustomField.getValue(issue)

maybe just add, issue.customfield_10067.getValue

Michelle Gaul April 10, 2019

I also tried:

 

date started: {{issue.customfield_10049.minusMinutes(issue.customfield_10067.value)}}

but it didn't work either... and actually it returns the value already.

 

if i let the program show me in the description of a working auto-log rule  

{{issue.customfield_10067}}

it returns the value. But I dont know why it is not working when I combine them.

Is the minusMinutes() methods not compatible with a function inside the brackets?

Suggest an answer

Log in or Sign up to answer