My JSM Assets Schema Objects can be updated manually by users, and also by a dedicated API (Fixed User API Token). I have created a rule in Global Automation that is triggered whenever Objects in my Schema in JSM Assets is updated. I want to trigger it conditionally: only if the User who triggered the Rule (ie updated the object) was not my Bulk API User. I tried with
{{initiator.displayName}} {{initiator.emailAddress}} {{initiator.accountId}} but none of them works.
I also tried updatedBy != '"" , but doesn't work. How do I get the initiator of Rule?
That seems to be available only for work item triggers. You have two options:
1. Either use the REST API to get the object history to see who was the "actor": https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-id-history-get
2. Just provide the Object Developer role to the Bulk API User - this way everyone else just has a view (user role) permissions, so you don't even have to create this automation rule
Hope this helps, :)
Andrea
Our use case is not fulfilled by not allowing others to update so option 2 is not feasible.
Regarding Option1, it will trigger 1000s of API calls for each update that bulk API does just to capture 10-15 manually edited values per day.
Any other solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Our use case is not fulfilled by not allowing others to update so option 2 is not feasible. - what is the use case? Maybe I can help by understanding the use case better - I do understand the cause for concern if the bulk api user is making that many updates.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Python script updates the JSM Assets with data every few hours. It will update every field except some fields that are Manually Updated. We are tracking those field names in a attribute - Manually Changed Fields.
We want the rule to capture if the most recent change is by API or a user and then decide the next steps.
Everything is ready and working except we aren’t able to capture the user who triggered the rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If there's only a certain set of attributes that you want to listen for and not those attributes that only the Bulk API user updates, what you can do is use a new trigger component within automation to listen for only attribute updates. That way you can do the API call to get the actor.
It may not hurt to try the {{initiator}} or {{actor}} smart values too. This came out very recently! See an example here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just tested and neither initiator or actor work :(
However, you can use {{containerObject.id}} to get the id of the object to use the REST API endpoint to get the history.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you write the entire smart value for {{initiator}} to the audit log, what do you see when the rule triggers?
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Its blank.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We're using Assets as a CMS system, It's using automation to synchronise the data to Atlassian users, it's how we manage our JSM customer base.
This has been an issue for us too, i'm currently actually busy rewriting these rules.
What we do now is get the object history from the API, as suggeted above. we can dedact the actor and change from there.
I think using this, u don't actually need to store the 'manually updated' fields in a seperate field, as you can fetch them from the history output.
note: you should ignore the history log where type = 0, that is the 'create' event.
we use this one to fetch the object creator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.