I was able to make automation which goal is just create work items for each value in description separated by breakline. but for some reason i'm getting many more values in output, could you please help me with that issue?
Hi @J D -- Welcome to the Atlassian Community!
What does the content / structure of your Description field look like?
And, why are you using the asJsonStringArray function? That is normally used to build a JSON expression as text to perform a work item update. That function does not produce a JSON expression which allows referencing attributes.
When you want to use data in a Description field delimited by newlines, please use {{issue.description.split("\n")}} to create the list source for the Advanced Branch. And then use other text functions to further parse the results to check the content and create the work items.
And if you believe the parse content contains well-formed JSON, you could attempt to convert it (for referencing attributes) with the function jsonStringToObject:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#jsonStringToObject--
Kind regards,Bill
@Bill Sheboy thanks for the response.
that's what i got when used {{issue.description.split("\n")}}
Now, my description field is paragraph field that contains random words like:
Transmission
Ignition system
Engine
etc.
Could you please also provide me with details how to use jsonStringToObject? I feel like I'm doing it wrong way....
{{jsonStringToObject({{issue.description.split("\n")}})}}
I'm getting this error Failed to get value for jsonStringToObject({{issue.description.split("\n"): {{jsonStringToObject({{issue.description.split("\n")}})}}
The example Description you show is plain text, and not a JSON expression. Thus, there is no need to use any of the JSON functions.
To iterate over any non-blank lines in the Description, please try this:
For future rule needs with jsonStringToObject() and other smart value functions, please see the example in the documentation: once inside a set of double-curly brackets, you do not need additional ones. For example:
{{jsonStringToObject(issue.someField)}}
Thanks, that worked for me!!
For some reason I was wrongly updating log action field! Thank you so much, @Bill Sheboy!
Last one is the answer.
It looks like you're new here. Sign in or register to get started.