Forums

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

Automation copy value from a custom field

AldoCauchiSavona
Contributor
January 25, 2023

In our situation, the user is not allowed to set the priority in the portal via the Jira Priority field, but is given a different custom e field single select list where a subset of the Jira priorities are provided.

On issue creation, I am doing an automation rule to copy the user set value from the custom field to the Jira Priority field.

In the edit issue action, unless I'm mistaken I can choose the custom field to copy the value from, but I only get 'Copy priority from current issue'. I chosen Priority as the field to set, but instructing the action from where to copy the value from i'm not seeing.

Do I need to do the value change via JSON in the More Options JSON text are? If so, could you please give me a clue of how to do this because my JSON did not work (invalid JSON error), which currently is:

{"fields":
{"Priority": "{{triggerissue.fields.customfield__10259.id}}"
}
}

 

2 answers

0 votes
Tal Cohen Gmail
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 23, 2024

the following copied the priority name

{{triggerIssue.Priority.name}}

0 votes
Trudy Claspill
Community Champion
January 25, 2023

Hello @AldoCauchiSavona 

You don't need to use JSON for this. Simply start typing in the smart value for the source field.

Screen Shot 2023-01-25 at 10.31.34 AM.png

After typing in the smart value you need to click on the space below the field where it says Smart value '{{ to get it to actually keep the smart value you entered.

AldoCauchiSavona
Contributor
January 26, 2023

I get no option to set the field as a text, what i get is like this, or as Set where I m given a list of priorities to choose from.

Screenshot 2023-01-26 085639.png

Trudy Claspill
Community Champion
January 26, 2023

You need to click on the ... and choose SET.

Screen Shot 2023-01-26 at 8.37.28 AM.png

 

That will change the display to something like this, showing an actual Priority value.

Screen Shot 2023-01-26 at 8.38.43 AM.png

 

Then click in the field where the priority value (i.e. Highest) is shown and the full list of values will display.

Screen Shot 2023-01-26 at 8.39.38 AM.png

 

Then start typing the smart value.

Screen Shot 2023-01-26 at 8.40.39 AM.png

AldoCauchiSavona
Contributor
January 26, 2023

Oh, Many thanks @Trudy Claspill, I now managed to get the smart value in the Set value. However getting this error now:

{{triggerIssue.fields.customfield_10259}}
{{triggerIssue.fields.customfield_10259.value}}
{{triggerIssue.fields.customfield_10259.id}}
(The priority selected is invalid. (priority))

{{triggerIssue.fields.customfield_10259.name}}
(Specify the Priority (id or name) in the string format (priority))

What is the correct smart value to get the String or selected priority from a single-select list, please?

Trudy Claspill
Community Champion
January 27, 2023

You should be able to get the value of the field with 

{{triggerIssue.<name of field>}}

i.e.

{{triggerIssue.Story points}}

Use the Log action to print out to the Rule audit log what is returned by the various smart values you tried.

If the value is not an exact match for one of the display values or id of the options for the Priority field then you will need to use an If/Else Condition  to look at the value of the your custom field and then set the value of the Priority field to the correct corresponding value.

AldoCauchiSavona
Contributor
January 30, 2023

Is it possible to covnert the selected option to a string, because the error 'IDS-55 (Specify the Priority (id or name) in the string format (priority))' indicates to me that the value is not being given as a string. I onlt found th string to number command.

 

Inside a comment, {{triggerIssue.fields.customfield_123}} and {{triggerIssue.fields.customfield_123.value}} returned 'High', so do log action.Screenshot 2023-01-26 085639.png

Sorry for the spam messages

Trudy Claspill
Community Champion
January 30, 2023

I'm not sure of the solution for trying to directly copy the value from your custom field to the Priority field.

A solution that does work is to use an If/Else Condition block.

Screen Shot 2023-01-30 at 11.31.04 AM.png

In this solution you check the value of your custom field, and then use an Edit Issue action to set the Priority field to the corresponding value.

Screen Shot 2023-01-30 at 11.32.08 AM.pngScreen Shot 2023-01-30 at 11.32.20 AM.png

 

After the initial If block you would add Else-if blocks for each of the remain possible values for your custom field and setting the Priority field to match. 

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