Use Case:
I need to add a new row to an existing confluence page table when a new EPIC is created in Jira. The table consists of 3 columns. Issue Summary, Issue URL and Other Links. Basically what i am doing replacing the </tbody> with a new row closing with </tbody> in the webResponse.
{{webResponse.body.body.storage.value.replaceAll("</tbody>","<tr><td><p>Issue Summary</p></td><p>Issue URL</p><td><p>Other Links</p></td><td></td></tr></tbody>")}}
This works perfectly fine with text. What i want to do do get the issue summary and issue url from the trigger issue. But when i enter in smart values instead of text i get the following error
"Error rendering smart-values when executing this rule:"
I have tried a couple of different solutions.
1. replacing Issue Summary above with {{issue.summary}} gives me the same error
{{webResponse.body.body.storage.value.replaceAll("</tbody>","<tr><td><p>{{issue.summary}}</p></td><p>Issue URL</p><td><p>Other Links</p></td><td></td></tr></tbody>")}}
2. holding {{issue.summary}} in a tempSummary variable. It still gives me the same issue.
{{webResponse.body.body.storage.value.replaceAll("</tbody>","<tr><td><p>" + tempSummary + "</p></td><p>Issue URL</p><td><p>Other Links</p></td><td></td></tr></tbody>")}}
I have tried printing out issue summary in log action and it shows the correct values and even the tempVariable shows the correct values but i keep getting the above error
Hi @Gaurav Parab -- Welcome to the Atlassian Community!
Please try using the Create Variable action to build that replacement expression first, and then use that in the function.
<tr><td><p>{{issue.summary}}</p></td><p>Issue URL</p><td><p>Other Links</p></td><td></td></tr></tbody>
Please note I removed the outer quotation marks when using this type of replacement:
{{webResponse.body.body.storage.value.replace("</tbody>",varReplacementText)}}
Also note I changed from replaceAll() to just replace(). The replaceAll() function is used when using a regular expression for the search.
Kind regards,
Bill
Thanks! This worked perfectly! I guess nested smart values is not a functionality yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad to learn that helped!
Also, smart value expressions can be nested / used as parameters in many cases. But in the expression you tried, the issue.summary was contained within a quoted expression and had no tokens to offset it from the literal text.
Thus, another way to do this would be to define the initial text as a variable: <tr><td<p>
And then use that variable to chain, concatenate the values. Although that would be harder to read / maintain.
{{varPrefixText.concat(issue.summary).concat("</p></td><p>").concat(issue.url).concat("</p><td><p>Other Links</p></td><td></td></tr></tbody>")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got it! This is useful information. I do see a use case for this too!
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.