Forums

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

Replace() does not work with {{smart values}}

Anthony Nguyen
Contributor
July 28, 2024 edited

Text function replace does not seem to work with smart values, e.g. {{page.get("content").replace("</tbody>","{{entry}}")}}.

Failed to get value for page.get("content").replace("</tbody>","{{entry: {{page.get("content").replace("</tbody>","{{entry}}")}}​

What is the proper format to do this, if it is actually possible?


Actually, it seems that none of the text functions work with smart values, only literal ones. Is this just a known limitation?

3 answers

1 accepted

2 votes
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.
July 28, 2024

Hi @Anthony Nguyen 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

 

Until we see those...

Many of the rule functions will take smart values as parameters, although there are some exceptions based on context.  (For example, some functions may not take smart value parameters once inside of a list iterator.)

What is the source of {{entry}} and what is its expected value?  That may impact the replacement.

Until we know that...please try removing the quotation marks and nested curly brackets from the replacement text, including only the smart value:

{{page.get("content").replace("</tbody>",entry)}}

 

Kind regards,
Bill

0 votes
Alexandra DM
Contributor
October 21, 2024

@Bill Sheboy  @Trudy Claspill 

I'm trying to replicate the same question but with a simple test where I've created different variables to replace the content of div (html)

Variables
baseContent = <div id="content"> <p>This is the original content</p> <!--PLACEHOLDER--> </div>

replaceContent = <p>NEW CONTENT</p>

It only runs correctly when placed directly with values ​​set in the double quotes
combinedContent = {{baseContent.replace("PLACEHOLDER","W")}}

But when I want to pass the replaceContent variable it doesn't appear in any of the following tests
{{baseContent.replace("<!--PLACEHOLDER-->", replaceContent)}} -error

{{baseContent.replace("<!--PLACEHOLDER-->","${replaceContent}")}} -error

test_replace.png

 

What is the correct way to pass smart values ​​to a replace function?
It's Jira Automation Data Center

Trudy Claspill
Community Champion
December 6, 2024
0 votes
Trudy Claspill
Community Champion
July 28, 2024

Hello @Anthony Nguyen 

Can you provide more information about the context of your issue? 

If you are trying to use the in an Automation Rule please post images of the entire rule and the details of each step.

If the context is not an Automation Rule, what is the context?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events