Forums

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

How do I access user profile data in automation

Michael Wood June 21, 2022

I’m trying to set up an automation that uses an issue creator’s department (from their profile) to set a custom field but can’t seem to get it working. 
So far I’ve tried a bunch of smart tags in the json such as {{reporter.department}} and it shows success in the audit but clearly the tag is wrong as it’s still blank in the target field.

any help would be greatly appreciated 

1 answer

1 accepted

1 vote
Answer accepted
Marini Marini
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.
June 21, 2022

Hi @Michael Wood 

I don't think you can access the Reporter's profile from the Automation Issue Smart Value. The user profile is not stored in an issue.

I found the Cloud User Management REST API, Get Profile. But, the user who executes the REST API must have permission to update and deactivate the accounts owned by your organization. So, before you try the above REST API:

  • You must be the Organization Admin of the instance
  • You must claim the domain
  • Once the claim is successful, you will be able to manage all Atlassian accounts under the claimed domain
  • Then, you will have the permission to run the Jira User Management REST APIs
  • Automation also has a rule to "Send web request". So, you can use the REST API and process the response accordingly in the automation rules.

I hope the above answer helps!

Regards,

Marini

Michael Wood June 23, 2022

@Marini Marini This worked a treat. The only issue I encountered was with the documentation for smart fields. 

The docs stated to use {{reporter.accountID}} but it actually has to be {{issue.reporter.emailAddress}} on this Link 

 

Thank you for your response, this has been causing me a bit of frustration and this was easy to do with your answer

Micah Harley
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!
January 27, 2025

Old post, but it's still at the top of google, so here's how do to this now... basically still same solution, but updated link and an example...

The endpoint to get user profile data is:
https://api.atlassian.com/users/{{issue.reporter.accountId}}/manage/profile

Doc is now at here.

You need an Organization API Token to call it. This is different than the Jira API Token. You will also want to make sure "Delay execution..." checkbox is ticked, so the rule won't keep running without the response. Also, hide your authorization header... 

The response contains the Department in :
{{webResponse.body.account.extended_profile.department}} 

After that, it's pretty straightforward:
UserDepartmentAutomation.PNG

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events