I have a Jira Automation question. I have created a rule in UAT and tested and it works fine, but when I duplicated it in production, I keep getting a json error.
I am using a rule to create a new story in another project, when the originating story is marked "done". I am trying to replace words in the title (summary) with alternate words using the following json code in the "additional fields" section of "create issue" action:
Hello @Steven Johnson
The syntax works for me when I use it in a rule.
{
"fields": {
"summary": "{{issue.summary.replace("Prep Table","Pre-Prep Table")}}"
}
}
Do you have any other Advanced Edit functions in your rule? Perhaps the error message is referring to a different one. Can you show us the audit log and a full list of the components of the rule?
Other than being extremely lengthy, it's pretty straightforward. The error points to that exact JSON, but maybe I'm missing something. Here is the audit log with the error and the long components list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I am reading the audit log correctly, it seems that the problem is arising in the fourth IF block (noting that the third IF block is not an actual block that includes actions). Is that correct from your perspective?
And the JSON you are using is being used in a Create Issue action, correct?
And you are trying to set the Summary of the newly created issue to match the Summary of the triggering issue, but with text replaced. Correct?
If the above is correct, then you can simply set the Summary field using a smart value directly, without using Advanced Edit
{{triggerIssue.summary.replace("Prep Table","Pre-Prep Table")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you tested that expression initially, was that with Jira Cloud?
If so...I wonder if Jira Server/Data Center is having a problem with the nested double-quotation marks in the JSON to set the summary.
Regardless...setting the expression to the field directly as you described, without the advanced edit, seems a good work-around.
Thanks,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, yes, I did test on Jira Cloud.
In which case single quotes should be tried for surrounding the text values that will get replaced.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's always the simplest of solutions that I can never come up with. Thanks, that works for now (in UAT), so I'm hoping it works correctly in Production. The advanced edit before also worked in UAT but not Prod, so if this doesn't work then there's a discrepancy between our UAT and Prod.
I thought I was on server, not Cloud, but the double quotes worked exactly as written above, so I wonder why that is, if it's not supposed to?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We didn't mean to say that the double quotes would not work on Server, just that it was possible that they would not work because of the use of double quotes elsewhere in the JSON. I didn't test on a Server instance, so I could not say with certainty that the double quotes would or would not work there.
For the Advanced Edit working in UAT but not prod, were you running the exact same rule in UAT?
Lastly, if you find that the suggestion does work in prod, please consider marking the Answer as Accepted to help other users find the posts that include working solutions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Trudy Claspill
And yes, the rule was exact, double checked that, and had someone else look it over and run tests. I've had some other strange issues in the past when using the "additional fields", so I guess it's some unseen technical issue that I just am not seeing.
Your suggestion worked and was even easier to understand for future maintenance, so thank you!
Steve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.