Forums

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

Error when trying to trying to add a new row to a confluence page using nested smart values

Gaurav Parab November 5, 2024

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

1 answer

1 accepted

1 vote
Answer accepted
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 5, 2024

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.

  • create variable
    • name: varReplacementText
    • smart value:
<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

Gaurav Parab November 5, 2024

Thanks! This worked perfectly! I guess nested smart values is not a functionality yet.

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 6, 2024

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>")

 

Like Gaurav Parab likes this
Gaurav Parab November 6, 2024

Got it! This is useful information. I do see a use case for this too!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events