Hello, I have a field that is populated with multiple platform versions :
{ "Browser": ["1.2.3", "1.23.0"], "Extension": ["1.8.6p"], "Protect": ["1.98.4p", "1.98.4p", "1.98.4p"], "SSH": ["1.87.0"] }
Am trying to build an automation rule that parse the text and brake it into different fields like this:
Browser -> ["1.2.3", "1.23.0"]
Extension -> ["1.8.6p"]
I first tried to use this smart value : {{ issue.customfield_10582.asJson."Browser"}}
but i get nothing, so was trying to use asJsonObject but still can match.
any ideas?
Please try using the function jsonStringToObject() to convert the plain text to JSON which can access the elements with dot-notation:
Kind regards,
Bill
You will have to use smart values, based on text options.
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/
Then create a variable and use the smart value: {{issue.customfield_10582.substringBetween("[","]")}}
Then log this as well and see what you get as result.
With an edit action set the field based on the variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wondering why... this should JSON should be easier to extract data from.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then you need to set the options as an array.
{{issue.customfield_10582.asJsonStringArray}}
See https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
familiar with the documentation, thanks. its just keeps returning empty value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for example, if i use
asJsonObject: {{issue.customfield_10582.asJsonObject("Browser")}}
I'm expecting to get the values ["1.2.3", "1.23.0"] but instead im getting:
{ "Browser": "{\"Browser\": [\"1.2.3\", \"1.23.0\"],\"Extension\": [\"1.8.6p\"],\"Protect\": [\"1.98.4p\", \"1.98.4p\", \"1.98.4p\",\"1.1.1\"],\"SSH\": [\"1.87.0\"]} " }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you get on using {{issue.customfield_10582.asJsonStringArray}}
What you expect is not right, as the values you are trying to fetch in a single field, so you get everything.
You will 1st need to get the values in an array and from the array use the values you want to place in the respective fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok that helps, im just not sure why it doesnt allow me to break it into an array
When I'm using asJsonStringArray Im not getting back any value
Only if I'm trying to use asJsonObject as seen above
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As mentioned before the information you have is text, so you need to split this content, you can use the text smart value options for this.
See this form post on why setting text as as json object is hard and iratic.
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.
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.