I've replaced a labels field with an Insight multi picker field, but I'd really like to backfill the new field with the contents of the old automatically. Now, the automation for Jira plugin doesn't seem to have decent compatibility in terms of smart values with this, or at least I can't find the right syntax of smart value, so it looks like it'll be a case of using the additional fields JSON area.
Does someone have the right format I can try?
@Ravi Sagar _Sparxsys_ that is indeed the right format if you already know the asset ID (in your example 4548_11) you want to add to an issue, but since Stephen's question is about trying to backfill an Insight field based on existing Labels, there's a bit more to it.
The problem that I've found in testing is that Insight does not currently expose an API for doing a "search" by object name. You mentioned this yourself here:
I did a little digging though and did discover some interesting things. The Object Schema (project) corresponds to the first 4 digits of an asset ID. Unfortunately this doesn't seem to be stored on the Insight servers, and so you can only figure it out by adding a an asset to an issue and looking at the JSON for an issue, as you described here:
If you can get those 4 digits, then I believe the second digit after the underscore corresponds to the Object Schema "key".
Ok, I think we need some pictures.
Here's my Object Schema named Asset (AS):
I have 3 items, AS-1, AS-2, and AS-3.
Now, I added those items to an "Assets" custom field that I created for HELP-14:
And now, following Ravi's advice, I looked at the JSON representation of the HELP-14 fields by going to https://MYHOST.atlassian.net/rest/api/3/issue/HELP-14, and here's what the relevant custom field data looks like:
So you can see that the 7062 appears to be a consistent "project key", and then after the underscore, we have items 1, 2, and 3.
So then, what to do?
Well, depending on your number of Labels/Assets, and if each ticket only has one asset, you might be able to brute-force something in Automation by creating a mapping each label to the appropriate asset key.
With those constraints in mind, I created and successfully tested this very automation:
It's a horrible and frankly unworkable solution if you have more than 3 assets or more than one assets per ticket. But I'm sharing it to hopefully give you some ideas of what you're currently up against if you do try and implement something like this.
I wonder if @Ravi Sagar _Sparxsys_ might have a much cleaner way to do this with Scriptrunner, with maybe a nice way to loop through all the labels, and refer to a lookup table to construct the JSON to update the field? If so, I know I'd love to see it. :-}
Oh, hey, there's an API for searching for objects, and I think it may work by name:
Well, that certainly opens up some additional possibilities, maybe using web requests.
We also have Scriptrunner, let me know if you've come up with something I can use. I'd be very appreciative as interest in copying the old values to the new field is growing :(
also @Darryl Lee you're right, we have hundreds of tickets that have access to around 3500 possible hostnames that I now have objects for in Insight XD
It's so much easier to just send the tickets round a global transition using an Insight post function to fill the field. I suppose regardless of whether you use automation for Jira or the global transition, the issue updated stamp will be updated either way, so the same issue of old tickets potentially showing up on boards would be present, might as well do it the simple way. :(
Yes you can. Try this format.
I hope it helps.
Hi Everyone, In this roundup we combine all the jira automation rules to sum up story points across different issue types. We start from the lowest level, summing up story points from sub-tasks t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events