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

automation rule between link Last User and assigned user

Anupamshaw April 11, 2023

There is a attribute of User type Link User which is configured using some aql queries in a custom field ,I want to make the automation that whenever new asset came in object schema the assigned user get automatically filled with the last user from the property of the asset object

@Ravi Sagar _Sparxsys_ photo.png

1 answer

1 vote
Gideon Nolte [Jodocus]
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.
April 11, 2023

Hi @Anupamshaw

I'm not 100% certain, that I got what you are trying to do, so I'll rephrase your problem in my own words and try to give a solution for that. 

The problem: Whenever a new asset of a given type is created, look at the last object of said type and copy the value of the "Link User" attribute in that asset to the newly created one. 

Is that correct? If yes, you can achieve this behavior by creating a rule via the global automation setup. Use the "Object" trigger, and configure it to listen for creations on a given scheme. 

image.png

Next, you will need to use the "Lookup Objects" action with the following configuration (change to your scheme). `objectType = {{object.objectType}} AND "Link User" is not EMPTY order by created desc`
image.png

With this, you can use the `{{lookupObjects}}` smart value, to access the objects you just searched for.

Next, you can edit the object that was created by using the "Edit Object" action and use this smart value to set the "Link User" attribute: `{{lookupObjects.first."Link User".accountId}}` 

 

Hope this helps. 

Greetings

Gideon

Anupamshaw April 11, 2023

Hi @Gideon Nolte [Jodocus] The above solution which you suggested i am not able to get a desired output,
Please ,Let me explain you from the very beginning ,there is a Last user attribute field in the asset object whenever we run a discovery import you can refer the above image below the vendor property the last user is coming it is basically the system name of the user of the device,
And there is a list of user in the jira admin portal where the name and email id is present of the user ,
I want to make a automate flow of mapping a link between the last user of the asset to the assigned to ,where 'assigned to' is the custom field which i have configued by following some aql queries.
Means when new asset come to the schema the "assigned to " field will automatically filled by the last user name which is having some connection with the jira users that i wanted to do.

hope i am  now clear to you
Thanks and regard,waiting for your reply
Anupam shaw

Gideon Nolte [Jodocus]
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.
April 11, 2023

I think i get it, but I am not sure.
You want to put a User (Jira user) into the "Link User" attribute of an asset based on the name of the user provided in the "Last User" attribute of said asset?

If yes, you might want to create a seperate object types for "Asset Users" which hold their name in one attribute and their account in another one. This way you could have an attribute on the asset referencing to an "Asset Users" object which you could fill during import with an aql import mapping like Name = ${Last User}.

Alternatively, you could use the Jira REST API via "Send webrequest" to search for a user by name (Last User) and use the accountId given in the response to set as the value for "Link User".

Hope this makes sense and helps.
Greetings 
Gideon 

Anupamshaw April 11, 2023

hi  @Gideon Nolte [Jodocus] 

 Yes you are right i want this solution,but can u please add screen shot it would be great i am facing some diffulties it resolving it.
Thanks and regards
Anupam shaw

Gideon Nolte [Jodocus]
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.
April 12, 2023

Great, sure! Since it's easier to do it with automation and you don't need a new object type for this approach, I'll go with that.

  • Trigger: Object - created
  • Action: Send Web Request.
  • Condition: Advanced Compare Condition:
    • {{webhookResponse.body.first.displayName}}
    • equals
    • {{object.LastUser}}
  • Action: Edit Object
    • Set "Link User" to {{webhookResponse.body.first.accountId}}

 

This rule will make a request to Jira's API whenever a new object is created, to search for a user based on their name. When the user it finds has the same name as the user in the "Last User" attribute, it will set the "Link User" attribute to the account ID of the user it just found with the API Call.

Hope this helps and makes sense. Feel free to ask if you run in any trouble.

Greetings

Gideon

Anupamshaw April 13, 2023

Hi @Gideon Nolte [Jodocus] 
when i tried i faced this error can you please have a view.
Or we can schedule a call according to your time within 2 days time stamp .
waiting for your reply and need help it is urgenceny to me

MicrosoftTeams-image.png

Gideon Nolte [Jodocus]
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.
April 17, 2023

Hi @Anupamshaw

unfortunately I won't be able to schedule a call. But I might be able to help on from here.
From what I see, it seems like the REST call was not able to get the accountId. You can try using the "Log"-Action to debug the rule by logging the response from the REST API and figure out potential errors. One thing i would double-check is authentication. 

If possible try to log all the evaluations of the smart values i sent you and reply with them. That might give me more information to work on for finding the problem.

Greetings
Gideon

Anupamshaw April 17, 2023

HI @Gideon Nolte [Jodocus]  
Thanks for the reply the information and the steps  which you i have followed and tested but when a new asset is coming it is working fine means it is automatically assigning the asssigned user with the LAST USER ,but the problem arises when i want to do it for the whole set of  asset present in the schema can u please guide What mistake i have done or any addditiion formula i have to use,,
Waiting for your reply
Anupam

Anupamshaw April 17, 2023

Hi @Gideon Nolte [Jodocus] 

when I usefd Send Web Request and gave the appropriate API with authentication but  

after the get request gives me this response where body is null , So for  that reason I could not retrieve the accountId or displayName of the user. 

So can you please give any suggesstion for how to get the whole body of user.

MicrosoftTeams-image (4).png

Suggest an answer

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

Atlassian Community Events