Missed Team ’24? Catch up on announcements here.

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

Automation Rule: Assign based on comment value

Ben Hart April 30, 2024

I have the following rule:

 

When: All Comments

If: Service == placeholder

If Block-

If: Status is Open

Then: Transition to WIP

And: Assign the issue to user who triggered (service account)

And: send web request

Else If-

Elif: Status is not Open

Then: Add value to audit log {{issue.comment}}

And: send web request

If: matches {{issue.comment}} contains regex \w+\.\w+(?=@)

Then: create variable {{ackname}} from {{issue.comment.match("(\w+\.\w+(?=@))")}}

And: assign issue to {{ackname}}

And: add value to audit log 'Ack name is {{ackname}}'

 

Now what happens is that {{ackname}} is not defined.. actually neither is {{issue.comment}}.. I've googled but cannot find any user-friendly docs on what possible smart values there are for this nor how to use regex with the create variable..

But I bet my entire problem is that I'm not defining the values correctly. If anyone can help I'd be super appreciative.

 

1 answer

0 votes
Calvin
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 30, 2024

Hay mate, I'm a little confused, but if it helps:

  • Is the trigger run on each new comment? If so maybe you can use {{issue.comments.last.body}} to get the text
  • I'm assuming all users you are taking from {{ackname}} already has a JSM account, as I think its needed to assign to? (I might be wrong on that).
  • I'm not too sure where the webrequest comes in, are you looking at comparing the webrequest with the regex to see if an email exists, and if it does pull that email into the assignee?
    • Is there any other way to do what you're looking for? Or are you particularly trying to make the assignee be based on this webrequest and comment comparison?
Ben Hart May 1, 2024

Howdy!

Ok so I probably coulda left the web request parts out because they are not related to my question.. directly. However I thought including every step of the rule would be appropriate.

The issue is triggered on all comments yes, thanks for the last.body tip!  I did tweak the create variable and I now have the email preamble!  Next step now is to figure out how to remove the period (.) and replace it with a space.

I am now using: {{issue.comments.last.body.match("(\w+\.\w+(?=@))")}} to define the variable.  I'm sure there's a way to make use of .replace on this.

Every person in this Project also has an account on the web request side.. however the only way I can get any sort of reference to the person is this comment, with their email address in the body. So the idea is to set a var with that email preamble (complete!) and now replace the period with a space. Then I can hopefully use the variable to define an Assign User step.

 

Is there any other way to do what you're looking for? Or are you particularly trying to make the assignee be based on this webrequest and comment comparison?

 

I don't think so honestly.

Suggest an answer

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

Atlassian Community Events