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!