Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,334
Community Members
 
Community Events
185
Community Groups

Jira automation can not set an Insight object in custom field

Hey guys

 

Having Insight configured, with plenty of objects.

HWC-1 to HWC-300

 

In Jira automation, trying to make an automation to set an Insight object "Factory" on custom field 10772 when user has selected proper factory name

You can not choose Insight custom field field (I mean i could for a while but then it disappeared) so using "More options".

Using that code

{
"fields": {
"customfield_10772": [{ "set" : [{"key":"HWC-30"}] }]
}
}

I can see that something happens (because the field gets blanked if something was in it) but definitively whatever what I tried, it just does not work.

What to do ?

And if I arrive to it, how to use {{lookupObjects}} (which already displays HWC-30 in logs) ?

thanks

 

 

4 answers

1 accepted

5 votes
Answer accepted

Re-posting as an answer rather than a comment.

I eventually got this to work, but the documentation was not helpful.

Get your insight workspace ID via the REST endpoint via a logged in browser:

https://<workspace>.atlassian.net/rest/servicedeskapi/insight/workspace

In your IQL triggered automation step - which has access to the resulting {{Object}}s, via additional JSON, use:

{
  "fields": {
    "customfield_10135": [{
      "id":"abcd-abcd-1234-abcd:{{Object.id}}"
    }]
  }
}

Where customfield_10135 is the custom field ID of your *Insight objects* custom field (NOT assets), and abcd-whatever is the workspace ID from your REST result.

In the example above, you'd use:

"customfield_10772": [
      {
        "id": "82b9f04d-8bdc-47c7-9211-8787900659fa:24"
      }
    ]

 

Hope this helps!

1 vote
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 03, 2021

Hi @Dominique Wille

If you want to set an object in an insight custom field you actually have to use the full field information of an object.

In the jql search lin advanced mode and lookup your field with the object you want to use. It will be a long string that includes the hwc key + the actual name of the object.

Try copying that full string and pasting it to your automation rule.

Regards

Thansk for answer.

However I am not sure I get it. So far my understanding is that information is not duplicated in the issue, but it is a pointer that points to an Insight object.

When I do a "get issue" I get only pointer info.

"customfield_10772": [
      {
        "workspaceId": "82b9f04d-8bdc-47c7-9211-8787900659fa",
        "id": "82b9f04d-8bdc-47c7-9211-8787900659fa:24",
        "objectId": "24"
      }
    ]

 

What I need to have is something dynamically, so no need to copy anything anywhere.

 

1 - In the triggered automation rule (field edited), get the Insight object (OK) 

objectType = "Factory" AND "Factory label"={{fieldChange.toString}}

this gives me a nice 

{{lookupObjects}} 

In logs, I see content (maybe mapped) is "HWC-30" or other, works ok dynamically

 

2 - Edit the Insight custom field, in the issue that triggered automation

I do not want to do anything in Insight itself.

The  "official way" of setting a field does not work with {{lookupObjects}} so I am trying first manually with a key.

I tried also to blank the field, and push workspaceId, id, and objectId, but still no luck.

 

Annoying... maybe there is something else.

Like Fabian Lim likes this
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 03, 2021

Ah I see.  

I would use the built in insight postfinctions then. There is one about writing a value based on a insight customfield selection. However, they only work when you are performing a transition.

So if you want to edit it, you need to create a transition that calls itself with a transition screen that provides the insight custom field that makes the initial selection.

I hope this helps.

Would like to find something a bit more elegant...

I eventually got this to work, but the documentation was not helpful.

Get your insight workspace ID via the REST endpoint via a logged in browser:

https://<workspace>.atlassian.net/rest/servicedeskapi/insight/workspace

In your IQL triggered automation step - which has access to the resulting {{Object}}s, via additional JSON, use:

{
  "fields": {
    "customfield_10135": [{
      "id":"abcd-abcd-1234-abcd:{{Object.id}}"
    }]
  }
}

Where customfield_10135 is the custom field ID of your *Insight objects* custom field (NOT assets), and abcd-whatever is the workspace ID from your REST result.

In the example above, you'd use:

"customfield_10772": [
      {
        "id": "82b9f04d-8bdc-47c7-9211-8787900659fa:24"
      }
    ]

 

Hope this helps!

Like # people like this
František Špaček _MoroSystems_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 29, 2021

@Nick Thomsonyou sir are a hero.

 

For those looking for complete solution:

First you have to use action "Object lookup" where you can use smart values. In my case I used:

objectType = Organization AND "Name" = "{{issue.Name of the organization}}"

This saves result in another smart value {{lookupObjects}}

You then have to find insight id of your instance as stated above.

Then you can use "Edit issue", turn on advanced mode and have something like this:

{
"fields": {
"customfield_10060": [{
"id":"abcd-123456-efgh-asd65dca:{{lookupObjects.id}}"
}]
}
}

Beware that I haven't tried this for multi object field - it might need a bit different.

Like # people like this
Rudy Holtkamp
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 03, 2021

I second that!

@Dominique Wille can you please accept the answer of @Nick Thomson

It will help a lot of people who are facing the same issue.

Thanks @Rudy Holtkamp @František Špaček _MoroSystems_ . As I originally posted a comment reply, I have reposted as an answer below.

Glad I could be of help!

Wanted to add this on for anyone searching for this issue...

This is for insight objects that utilize a key

Setting the key sets the insight object as the one you want to put in. 

Example:

{
"fields": {
"customfield_id": [
{
"key": "Put key here"
}
]
}
}

Yep here's an example of mine where I set two insight fields including a second one that normally only shows its options based on the input to custom field 17700 and also setting a customer request type at the same time

 

{
"fields": {
"customfield_17700": [{
"key": "SQ-349938"
}],
"customfield_17701": [{
"key": "SQ-350003"
}],
"customfield_13704": "Infrastructure Request"
}
}
0 votes
Muhammet Ayal
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2022

Hi Team, 

This is work for me, thanks

 

{
"fields": {
"customfield_10520": [{
"id": "956a4a68-32e1-4216-bab3-edcf04027c1e:2248"
}]
}
}

Screenshot 2022-05-28 145358.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events