Match users in CSV import to user type attribute of Assets objects
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Learn how to import users as attribute values in Assets Cloud using Atlassian Account IDs.
Solution
Find the Atlassian Account ID for users
To import users into a User-type Assets attribute, you must match on Atlassian Account IDs. Export them from yoursitename.atlassian.com/admin/users > Export users, then use those IDs in your CSV.
Use automation to update the user attribute based on email addresses
Let's say you have an object type called "Person" that has the attributes:
"Jira User" of type "User" - this attribute needs to be updated with the corresponding Jira user for that object.
"Manager" of type "Object" - this attribute is self-referenced and stores the manager object of the user.
"Jira Manager" of type "User" - this attribute needs to be updated with the corresponding Jira user of the manager for that object.
"mail" of type Text - stores the email address of the user.
These steps will help you update the "Jira User" attribute with the corresponding user by fetching the user details using the email address stored in the "mail" attribute:
Create a global automation rule triggered when an object is created (or scheduled + Branch on AQL).
Branch on AQL over the object schema, then use Create variable actions to look up the Jira user by the email stored in the object's
mailattribute, and set the Jira User attribute.Add two Create variable actions and create these variables:
Variable 1:
name: EMAIL
Smart value:
{{object.email}}
Variable 2:
Name: emailManager
Smart value:
{{object.Manager.mail}}
Add a Send web request action to get the User account ID using the search user API:
Web request URL:
https://<Cloud site URL>/rest/api/3/user/search?query={{EMAIL.urlEncode}}Configure three Headers:
Content-Type: application/json
Accept: application/json
Authorization: In the Authorization header make sure that you add the keyword Basic followed by the base64 of your emailaddress:APItoken. So if the base64 of the emailaddress:APItoken is AB12XY45 then to the Authorization header add the value Basic AB12XY45.
HTTP method: GET
Web request body: Empty
Check the option "Delay execution of subsequent rule actions until we've received a response for this web request", as the response contains the user's Atlassian account ID.

Create variable in the rule to store the account ID of the user:
Variable name: AAIDUser
Smart value:
{{webResponse.body.accountID}}
Next, send a web request using Send web request action again. Use the same content from step 4 except for the Web request URL field which should be:
https://<Cloud site URL>/rest/api/3/user/search?query={{emailManager.urlEncode}}⚠️ Make sure you check the option "Delay execution of subsequent rule actions until we've received a response for this web request"
Add another Create variable to store account id of the manager:
Variable name: AAIDManager
Smart value:
{{webResponse.body.accountID}}
Add an action to Edit object and set the attributes using the variables you just created:
Jira Manager:
{{AAIDManager}}Jira user:
{{AAIDUser}}
Publish the rule.
You can edit the rule according to your requirements, for example, by removing those actions in case you don't have the manager attribute.
Once the rule is saved, run it on one object and confirm the User-type attribute resolves to the correct Jira user; if blank, verify the email in the mail attribute exactly matches an active account.
Update more than 50 objects
Automation has a limit of 50 objects per update. So, depending on the number of users you would like to update, it may be that no new objects are picked up by the branch, as the "Jira user" field remains empty for those objects.
In that case, you can add an attribute in the "Person" object type, say "Last Sync date" of type date, and use this to go through the objects that have not been synced since the last update. This value will help us iterate over all the objects using an automation rule, and the update will be performed only on those objects that have not been updated on that day.
After you have added the above attribute, you need to make changes to the above rule as follows:
Update the AQL in the branch as:
objecttype = "Person" and mail is not empty and "Jira User" is empty AND ("Last Sync date" < startOfDay() OR "Last Sync date" IS EMPTY)This will only check those objects that have not been picked up by the automation rule on the same day.
In the Edit object action, add attribute "Last Sync date" and provide the value:
{{now.format("dd/MMM/yy")}}This will update the attribute to store the date when the automation rule picked this object to check for the corresponding Jira user.
Another option is to make use of Dynamic Looping.
We have a feature request to expand the number of objects that can be updated per rule: JSDCLOUD-10643 - Ability to update more than 50 objects in a single Assets automation run.
For more examples, refer to the article Update Asset object attribute values using automation
Was this helpful?