Greetings!
To ease statistic collection I've added "Issue Checklist Pro" plug-in and created multi-user picker custom field to collect data from checklist section. And now I'm trying to implement auto-copying of specific information from the field.
Current case:
"Issue Checklist Pro" plug-in allows to tag (mention users) via their names, but transform it to their ID's after changes were applied (at the end it looks like:
"info1 @user1_id
info2 @User2_id" ).
I need these ID's to be copied and paste in multi-user picker custom field (not only one but as many as numbers of ID's mentioned in checklist section)
I'm new to Java Script but trying to use this script with Smart Values for this purpose:
{
“fields”: {
“customfield_10049": [{
“id”: “{{issue.customfield_10048.match(“\[a-zA-Z0-9]{24}\“)}}”
}]
}
}
*customfield_10048 - Donor field: "Issue Checklist Pro" plug-in text field
*customfield_10049 - Recipient field: Multi-user picker custom field
*[a-zA-Z0-9]{24} - RegEx for User ID
Tried to correct script many times, but continuing to receive an error: "(data was not an array (customfield_10049))"
(When I use PUT request with specific ID, not RegEx it's working properly)
Could you please help me to retrieve ID's from donor field and put it to Recipient one.
And somehow make 'issue.field.match' loop though donor field to find all ID's and then insert them into Recipient field.
Thank you in advance!
Hello @Anatoly Ovsyannikov,
When it comes to the regexp, we use the following in Issue Checklist Pro for user IDs (please note that it supports an older way of mentioning too, so you could probably simplify it):
/(^|\s+)@([a-zA-Z0-9\u0400-\u044f_.+:-]+)/g
As for the "(data was not an array (customfield_10049))", I think it is due to the smart value / regexp used incorrectly. I hope someone more skilled in Automation can help here.
Cheers,
Jack
Yes, and...to what @Jack Hunter [HeroCoders] suggests:
Once you get your id values out of the checklist, you can use text and list functions to get the value into the format shown in this documentation:
To help build that, I recommend just writing to the audit log initially until it works as expected, and then try the update of the custom field. Perhaps even put it into a created variable to help prevent parsing errors.
One more thing: if you are using "fields" in the JSON, that takes the place of "update" and "set", so there is no need to use the "put". Please look here for information on that: https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/#Advancedfieldediting-JSON--What-sthedifferencebetweenupdateandfields
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.