Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation Custom Field not filled

Michael July 7, 2020

Hi there,

i am sure this is a quite basic question, but i wasted a lot of time yet, and didnt get the point. So i ask here:

I am trying to fill a new generated ticket via automation. It works quite well, as long as i can use the click method, but when going for the "additional fields" i fail. I have to do it that way, because clicking doesnt offer me all the fields i need.

So i already found out my customfield is: customfield_13374

What i want is that the customfield gains the value of the same customfield, but in the trigger ticket. So i tried different variances of:

{
"fields": {
"customfield_13311": {{ triggerIssue.customfield_13311.value }}
}
}

The Field i am trying to copy from and to is a User Picker. I think that there might be my misstake somewhere. I´d have to do this for some different type of fields, if the first one works finally.

Whatever i do, the field always remains empty, or the automation fails.

 

Can you help me out?
Thank you very much.

Have a nice day

Michael

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
July 7, 2020

Hi @Michael 

I have noticed some odd behaviors when fields are empty/nil, causing rules to either fail or show false success.  To work around this you could:

  • Use the default field handling for empty fields:  {{somefield|somedefault}}
  • Use a if/else structure to explicitly set a value when the source is empty

Best regards,

Bill

Michael July 8, 2020

Hello @Bill Sheboy

thanks for your reply. Giving a default would be a nice option, but i didnt quite get how to do this.

I tried it this way and also with the default area within the fields part, but in both cases he doesnt like it because it isnt a valid json for him. How to do it right?

{
{{"customfield_13311"|"0"}}
"fields": {
"customfield_13311": {"id":"{{triggerIssue.customfield_13311}}"}
}
}

 

Also is there a link to the documentation on how to do if - else statements i didnt really find anyhting while going through it, and it would be really helpful in several future tasks i guess.

 

Have a nice day

Michael

Bill Sheboy
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.
July 8, 2020

Hi @Michael 

Regarding default values, I have only used the inline/smart value method noted, not in the JSON.  Try experimenting around with the quotes to see if that is the issue, or see if you can learn more here: https://support.atlassian.com/jira-software-cloud/docs/what-are-smart-values/

And, here is the documentation info on the if/else structure for rules:

https://support.atlassian.com/jira-software-cloud/docs/automation-conditions/#:~:text=regular%20expression%20field.-,If%2Felse%20block,the%20set%20conditions%20are%20met.

Best regards,

Bill

0 votes
Michael July 7, 2020

Okay, i came a lot further, just to get to the next problem.

 

Working is:

"fields": {
"customfield_13311": {"id":"{{triggerIssue.customfield_13311}}"}

 

But if the field is not filled, he stops the automation there, instead of just taking an empty value too....

Bill Sheboy
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.
July 9, 2020

Hi Michael,

What is the field type?  I tried the following as smart values for text, number, and datetime fields and it worked to handle an empty fields as an empty string: {{issue.somefield|""}}

When I exported the rule JSON, it escapes the quotation marks, so try that if entering the JSON directly: {{issue.somefield|\"\"}}

Michael July 9, 2020

Hi Bill,

its a Userpicker - thank you i´ll try that one out.

Have a nice day.

Michael

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events