Hi All,
It looks like {{issue.properties}} smart value returns a JSON object.
I would like to do some list-based operations on these properties, such as getting the number of properties or finding properties that start with a certain substring.
For this, I was thinking of converting {{issue.properties}} from JSON to a list.
Is there a way to do that?
Thank you!
Hi @Serge Kravchenko -- Welcome to the Atlassian Community!
In my experience, some smart value content in automation rules which appears to be JSON or list values is neither of those things. The only way to know is to attempt to parse them.
Have you tried using list operations on your specific issue property?
If that did not work, have you tried using match() or split() to transform the values into a list?
If you only need the number of properties for a specific issue, perhaps call the REST API endpoint to get the property keys: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-properties/#api-rest-api-3-issue-issueidorkey-properties-get
Kind regards,
Bill
Hi Bill, thank you so much for your response!
Yep, I tried using list properties such as size and string methods such as match(). Neither of them worked, so I concluded that the value is a JSON object. :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The match() could be encountering challenges if there are any embedded formatting characters in the content, such as newlines causing the regular expression to halt processing. One workaround for that is to replace such characters prior to match attempts.
Without seeing the specifics of the content in that smart value, I recommend reviewing it to identify where / on-what a split() could be used to produce a list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill, I don't think any of these methods are available for a JSON object which {{issue.properties}} seems to return. I tried them, they don't return anything.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is unclear to me of that smart value always contains JSON or if it is plain text. If it is JSON and contains a list, it should be capable of iteration and list function usage.
I recommend writing the smart value to the audit log, then experimenting by picking text within the result to use with the split() function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just checking in...were you able to try writing the returned properties to the log to find how to parse them?
To just count them, this seems to work by converting them to text and then splitting.
Thanks!
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.