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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using a smart value to add an organisation to a ticket Edited

I have a value stored in a smart value lets say "ABC Company".

 

Using Project Automation, I want to set a ticket's organisation to this value (I will ensure there is an organisation called "ABC Company").

 

It doesn't appear to be supported the simple way so I'm keen to hear some more advanced solutions.

 

Cheers

Oliver

 

edit org.PNG

 

2 answers

1 accepted

0 votes
Answer accepted

Managed to get this working with the help of Atlassian support.

For posterity, the method:

 

Use the "send web request" in automation, post custom webhook data:

{
"name": "{{smartvaluecontainingmyorgname}}"
}

 

Then Edit issue, advanced:

{
"fields": {
"Organizations": [{{webhookResponse.body.id}}]
}
}

0 votes
Dirk Ronsmans Community Leader Sep 18, 2020

Hi @Oliver  and welcome to the community,

I've take a look and tried some thing and here's what I came up with:

Instead of setting the field through the UI you can go to the Advanced portion of the Edit Issue and create a JSON Payload.

To set the organization that would be:

{
"fields": {
"Organizations": [4]

}
}

 

This will add organization with id "4" to the issue.

The id you can get from the url when you open an organization:

for example with me: ]/jira/servicedesk/projects/ISD/organization/4

So for one I think you would need to store the Id of the organization that you want and not the name.

Then you can use the smart value system to get the value fro mthe custom field:

{{issue.YOURCUSTOMFIELDNAME}} (and replace that in the JSON)

There might be a cleaner method of "adding" cause there should be an operation you can give:

 "name": "Organizations",
"key": "customfield_10002",
"autoCompleteUrl": "/rest/servicedesk/1/organisations/project/10003/search?query=",
"hasDefaultValue": false,
"operations": [
"add",
"set",
"remove"
]

 

but the idea is that using that advanced portion you basically send a payload like you would in a REST call  (cause thats probably what it is) but to a predefined endpoint to edit the issue.

Hi Dirk

 

Thanks for the response. This may work if there is a way to convert an org's id from it's name? I only have the name available in my smart value (I'm parsing it from text).

Cheers

Oliver

Hi @Oliver ,

I'm afraid not, your smart value is essentially just text so it has not attributed to pull from. As far as i can see there is also no way to parse the textual value to a id in Automation. (using a script you'd probably could just do a GET of the organizations and see their ID's)

The only way my 8am brain can come up right now is to use a hardcoded conversion and that works depending on the amount of organizations you have and how often then change.

I tried it also in the other formatting but without any luck on text. the add operation just expects a number parameter.

{
"update": {
"Organizations": [{
"add": 4
}]
}
}

Imo, you could either:

1) Create a 2nd automation that is basically a collection of IF statements that updates a helper field (e.g. OrgID) that at creation converts the textual organization to the id.

And then use that OrgID field change in your initial automation to set hte correct ID from that smartvalue.

OR

2) Add these if's in your original automation and hardcode the id in to your json update.

 

neither seems to be a great solution and depending on the amount of organizations i would go 1) (if you have a lot of them so you can do the ID maintenance in one place) or 2) just to have a single automation.

 

Sadly the only way this will be different is when you can pass a textual representation of the organization to the call (or run a small script in your automation). I understand Atlassian's point of view here so that when you change the organization name the ID remains the same.

If you don't find either solution works for you I can only suggest to open either:

Move to something like Scriptrunner so you can do the GET first and then a PUT to set it and have more control.

OR/AND

Open a call with Atlassian (as they own the Automation part now) to see whether they add some component that allows you to add small scripts..

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

241 views 1 6
Read article

Community Events

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

Events near you