I've Field 'A' of single select drop down with values -
One
Two
Three
Four
I'm trying to write automation logic which will update another number field 'B' to a number corresponding to value of field 'A'. However seems I'm missing something to make it work correctly, none of the following expression syntax working for me -
{{issue.A.replace("Four",4).replace("Three",3).replace("Two",2).replace("One",1).asNumber}}
{{issue.A.replace("Four","4").replace("Three","3").replace("Two","2").replace("One","1").asNumber}}
Appreciate any help with this.
Hi @Gautam Poddar -- Welcome to the Atlassian Community!
When you note "...none of the following expression syntax working for me...", what are you observing happening? What do you see in the audit log?
Have you tried to split this expression up incrementally and write to the audit log to see what is happening? For example:
Best regards,
Bill
Hi @Bill Sheboy ,
Thanks for responding.
Yes, I looked into the audit log but it just shows blank/null value at the placeholder.
I tried splitting up the expression too as you've indicated for troubleshooting but not much luck with that either.
{{issue.A}} returns the selected value e.g. Four however {{issue.A.replace("Four",4)}} returns nothing while the audit log shows success.
Thanks,
Gautam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, and that may mean some typing-issues are happening.
Please try: {{issue.A.value.replace("Four","4")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy
That definitely did the trick! now it's working fine. Also I noticed {{issue.A.value.replace("Four","4")}} works but {{issue.A.value.replace("Four",4)}} doesn't.
Just to summarize for benefit of others in future, the correct expression here would be {{issue.A.value.replace("Four","4").replace("Three","3").replace("Two","2").replace("One","1")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yup, that makes sense for the same reason: the replace function is taking two string parameters.
I am glad to hear that is working. Please consider marking this question as "answered" to help others in the community searching for solutions find them faster. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.