Jira Automation - Extract last comment author only if 'accountType' = Customer

Jamie Eliya October 19, 2021

Using jira automation, I am trying to extract the last commented customer in issues, excluding agents, and place this value in a custom field called "Last Commented Customer".

If you look at the json of one of my issues, you can see that customer comments contain the following attributes:

self: "https://xxxxxx/rest/api/3/issue/12345/comment/1234",
id: "1234",
author: {
self: "https://xxxxxx/rest/api/3/user?accountId=qm%xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
accountId: "qm:xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
emailAddress: "jon.doe@exampledomain.com",
avatarUrls: {
48x48: "https://xx.net/default-avatar.png",
24x24: "https://xx.net/default-avatar.png",
16x16: "https://xx.net/default-avatar.png",
32x32: "https://xx.net/default-avatar.png"
},
displayName: "Jon Doe",
active: true,
timeZone: "America/New_York",
accountType: "customer"

 

Notice the very last line has the value: accountType: "customer" (I redacted sensitive information)

 

How can i extract the last comment author ONLY if the accountType = customer for that user? If there is no comment containing an author where the accountType = customer, then i do not want the last comment author extracted. In other words, if an Agent makes a comment, the comment author should not be extracted. Any help would be appreciated! :) 

2 answers

1 accepted

1 vote
Answer accepted
Jamie Eliya October 20, 2021

I got it working. All i had to do was create a user condition stating "Initiator is a customer"

 

2021-10-20_11-36-43.png

 

This automation rule extracts the last commented user, ONLY if the initiator is a customer (so if internal agents make comments, it will not run), and will edit a custom field called "Last commented Customer" with the comment author's email address using smart value {{comment.author.emailAddress}}

Bill Sheboy
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.
October 20, 2021

Well done, James!

I misunderstood and thought you generically were accessing the comments and not at the point of Issue Commented.

Kind regards,
Bill

0 votes
Bill Sheboy
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.
October 19, 2021

Hi @Jamie Eliya 

You may want to look at this article describing the new conditional processing for smart value lists.  Seems like that could help with what you asked.

https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Kind regards,
Bill

Jamie Eliya October 20, 2021

Hi Bill, 

Thanks for your response. Do you know how i would incorporate this into Jira automation? 

Suggest an answer

Log in or Sign up to answer