Missed Team ’24? Catch up on announcements here.

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

Set 'Reporter' Based on 'Custom Field'

Daniyal Anas March 17, 2022

Hi, Everyone! I hope you're well.

I was curious as to how I may achieve the following functionality: 

Your advice is greatly appreciated!

Use Case: Assigning 'Reporter' based on User Principal Name found in the 'Summary' field 

e.g. User Account locked out from: AE-DC3 xxxxx SAMPLE USER

Description: I am presently having 'User Account Lockout' alerts from my DC being sent to Opsgenie, to then have it create an issue in a JSM project.

The 'Reporter' field is being populated by the service account that's managing the communications between Opsgenie & JSM (which makes complete sense). 

What I'm wanting to figure out is how to parse a segment of the 'Summary' field ("SAMPLE USER") into a custom field and then have that somehow set the 'Reporter' from it, using Automation for Jira. 

Solution(s) Considered:

Step One: 

Automation Rule: Extract segment of 'Summary' field to insert into a 'custom field'

When: Issue created

IF: Issue matches JQL

summary ~ "User Account locked out from:*"

Then: Edit Issue Fields > "User Principal Name" > 

{{issue.summary.match("User Account locked out from:(\d+).*")}}

Issue Found: The designated smart field isn't pulling the segment of the 'Summary' field I'm wanting into the 'custom field' I have created/designated.

However, it is pulling the entire summary into the field using

 {{issue.summary.replaceAll(".*::","")}}

Referencehttps://community.atlassian.com/t5/Jira-questions/Populating-a-custom-field-from-certain-text-in-the-Summary-field/qaq-p/867986#U1974440


Step Two: 

Automation Rule: Set 'Reporter' Based on 'Custom Field'

Description: I am uncertain of how to attain this functionality

 

2 answers

0 votes
Daniyal Anas March 21, 2022

Error parsing smart value.JPG

0 votes
Mark Chaimungkalanont
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2022

I guess there're two parts here, first is to match the "SAMPLE USER" and then to use the value of the SAMPLE USER to set the custom field.

To parse out the SAMPLE USER, using the .match like you did should work. It's probably a matter to debugging the regex using the audit log https://support.atlassian.com/cloud-automation/docs/debug-an-automation-rule/

Automation Rule: Set 'Reporter' Based on 'Custom Field'

This probably isn't possible, the Reporter field requires the AtlassianID (UUID) of the user or their email address. Looks like the Sample user might be in numeric format?

If you do have the email address in a custom field (Say Field A) you can set the Reporter field to a smart value

{{issue.Field A}}
Daniyal Anas March 21, 2022

Hey, Mark!

I appreciate the advice! I'm able to parse the email address (replacing SAMPLE USER w. their email address via the alert params) out of the summary field and append it into a custom field. It's incredibly helpful to know that the email address should resolve into the Atlassian UUID! How would I go about setting the Reporter field to a smart value? (Newbie question). 

Greatly appreciated!

Dan A. 

Daniyal Anas March 21, 2022

It looks like its not accepting the email as a valid value for the reporter =/ Error parsing smart value.JPG

Mark Chaimungkalanont
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 21, 2022

Can you post a screenshot of what you're setting the Reporter to? It's also a good practice to add a "Log action" before editing reporter with the smart value you're setting in the reporter so you can debug / output it value and see what it's setting.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events