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

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?

 

 

 

 

 

 

1 answer

1 accepted

1 vote
Answer accepted
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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. 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events