Forums

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

Unable to update a field using smart values.

Dan Scott Enslen November 21, 2023

I've created an automation to update a field using the numeric portion of the issue key. Here is the rule. I create a variable using a smart value to extract the numeric portion. The log action indicates that the variable is created correctly and is reporting the expected value.

The field to update has a default value of 100 and I want to append the value in the create variable to the existing value. Why isn't it working correctly? The error message isn't detailed enough for me to understand what I am doing wrong.

Object ID field update_Creat var.pngObject ID field update_Log action request.png

Object ID field update_field edit command.png

 

Object ID field update_audit log for variable and error.png

1 answer

1 vote
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.
November 21, 2023

Hi @Dan Scott Enslen 

When using a smart value as a parameter in a function, like concat(), you do not need to repeat the double-curly brackets inside.  Please try removing them.

Kind regards,
Bill

Dan Scott Enslen November 22, 2023

@Bill SheboyI removed the mustache brackets as recommended. Rule audit says success but it isn't updating the field as expected. The field should be filled with 100923, not DOC-923 as shown. The field on the issue is blank as shown in the 2nd screenshot. If the field had populated at all it would appear in the Details section under Type. The 3rd screenshot of the editing screen also shows that the field is empty. I'm going to try to do a refresh action with log actions in case it's a race issue during creation.

Object ID field update_audit log for successful run_field not updated.png

Object ID field update_issue screen blank for successful run_field not updated.png

Object ID field update_issue edit screen blank for successful run_field not updated.png

Dan Scott Enslen November 22, 2023

Tried adding a re-fetch action. The audit log indicates the default value for the field is correct but it still isn't editing correctly and the field is still hidden even with the default value.

Object ID field update_audit log for successful run_with refetch_field not updated.png

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.
November 22, 2023

What is the value of the custom field you are trying to concatenate that value to?  If it is null, that may explain this.

Would you please post an image of you complete, updated rule, and an image of the edit action?

Dan Scott Enslen November 22, 2023

You may have something there. The field is null on creation even though it should have a default value of 100 which is indicated as being so by the audit log even though the Edit and view screens show it as null as does the find your smart values screen shots.

Is it possible this is an edit issue permission? I am just familiar enough with the server version. I checked and the permission is set for Any logged in user. I would expect to have a project role permission for the automation add-on like I have for my Cloud site, (atlassian-addons-project-access). It isn't an option in the project when I try to add it.

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.
November 22, 2023

Probably not a permissions issue as the rule's audit log shows the edit was successful.

This could be a timing / race-track problem...

The Issue Created trigger can fire so quickly the issue data is not yet available to the rule.  This can result in later rule steps working unexpectedly.  For your scenario, it is possible the custom field is still empty when it is used in with the concatenation. 

The work-around / fix for this is to always add the Re-fetch Issue action immediately after the Issue Created trigger.  That will slow the rule by about one second and reload the issue data before proceeding.

Please try adding that and observe the impact.

Dan Scott Enslen November 22, 2023

Thanks Bill, I'll work with the re-fetch action some more. I'll reply after I try some variations.

Have a nice holiday.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer