The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

When an object is created in Assets, create a customer in JSM and add him to the object's attributes

Yossi Avissar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 14, 2024

In asset management, I have an object type "Customer's Contact" with an attribute called "mail." I've attempted to create an automation rule that retrieves this mail, creates a customer in my JSM Portal, and adds the new customer to the new object's attribute (specifically, an attribute called "JSM User").

I'm using REST API requests for both actions. I can successfully create the users and retrieve the account ID. However, when I try to update the attribute, it doesn't work. It seems that these two actions cannot occur within a single automation rule.

I think that because when I split it into two different rules, it works well(I can update the object's attribute correctly using a PUT web request).

so, for now, this is my workaround: the first rule creates the users, and the second rule looks for new objects once an hour and updates their attributes.

first rule : attached in screenshot 

aut1.png

second rule: (lookup object looks for all the empty "JSM Customer" attributes. 

2.png

then, using GET method  ,send web request: orgURL.atlassian.net/rest/api/3/user/search?query={{ObjectsList.mail}}

then, using PUT method, send web request to update the customer in the object's attribute:  

https://api.atlassian.com/jsm/assets/workspace/WorkspaceNumber/v1/object/{{ObjectList.key}} with custom data : { "attributes":[ { "objectTypeAttributeId":"81", "objectAttributeValues": [ { "value":"{{webResponse.body.accountId}}" } ] }

 

Does anyone have ideas on how to make this work in a single rule?

 

 

 

 

 

 

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Fernando EugĂȘnio da Silva
Community Champion
July 15, 2024

@Yossi Avissar , Welcome to the Atlassian Community!

Have you tried using a delay between these actions?

What may be happening is that events within the same rule are executed at very small intervals to ensure that your next action was able to correctly retrieve the information processed by the previous action.

Try adding a Delay action and setting it to something like 1 minute between some key actions in your process. Or if applicable, use re-fetch to ensure that the rule will try to pull data saved in the previous action.

Some of these suggestions should help you keep everything working under the same rule.

If the problem persists, let us know.

KR,

Fernando

Yossi Avissar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 15, 2024

Hey @Fernando EugĂȘnio da Silva 

Thanks a lot for your answer!! 

I'm pretty sure that when I wrote this post, this feature didn't exist. 

anyway - it works! 

To sum-up the solution : 

insert this Delay action before the GET web request :

123delay.png

30 seconds should be enough.

and that's it. 

 

0 votes
Tom Gaffney
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 10, 2026

Hi @Yossi Avissar , we are considering implementing this but are wondering what will happen if the automation tries to create a customer that already exists?

thanks

Fernando Eugnio
September 10, 2026

Hey @Tom Gaffney ,

Before to create a new customer you can just to make a Lookup Object in the automation, by searching for a custom field (name, id) and compare: if {{lookupObjects.size}} > (greater than) 0 (exists a customer) / if {{lookupObjects.size}} < (minor than) 0 (customer doesn't exists). By following this you can compare and decide when to create a new customer.

 

As a best practice I always recommend to use IDs rather than names, because you can have multiples Tom's and Fernando's in your database but even this way to have a new customer called Tom as well. When you use ID as a lookup, you will have more accurated results.

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events