Hi, I'm trying to replicate 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 and/or valueReplace variable it doesn't appear in any of the following tests
{{baseContent.replace("<!--PLACEHOLDER-->", replaceContent)}} -error {{baseContent.replace("<!--PLACEHOLDER-->","${replaceContent}")}} -error {{baseContent.replace(\{\{valueReplace\}\},\{\{replaceContent\}\})}} -- error {{baseContent.replace("{{valueReplace}}","{{replaceContent}}")}} -error {{baseContent.replace({{valueReplace}},{{replaceContent}})}} -error {{baseContent.replace($(valueReplace),$(replaceContent) )}} -error
What is the correct way to pass smart values to a replace ? It's Jira Automation Data Center
I found an open defect for this symptom: https://jira.atlassian.com/browse/JIRAAUTOSERVER-975
It suggests a workaround to add trim() after the variable to force the type to text for the function parameter. Perhaps try that as:
{{baseContent.replace("<!--PLACEHOLDER-->", replaceContent.trim())}}
As an aside, this defect implies the Create Variable action for Jira Data Center automation is not returning a "string" (i.e., text type), which is both different from Jira Cloud and does not match the Server / Data Center documentation:
Kind regards,
Bill
Hey @Alexandra DM,
This would work in Jira Cloud:
{{baseContent.replace(valueReplace,replaceContent)}}
But the same function doesn't work in Jira DC... Perhaps, nested smart values aren't a thing in Data Center yet.
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.