Automation for Jira - Smart Values are neither lists nor text?

Michael Andolfatto
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.
July 26, 2023

Hi all, I've tried this a few different ways to no avail. The core use case I'm trying to satisfy is populating a regular Jira field (non-asset field) with Jira users based on an Asset object's attributes. So:

  • I have an Object Type called Asset Approvals
  • I have an object of this type called Software
  • The Software object has an attribute called Primary Approvers
    • There can be between 1 and 3 values for this attribute
    • Values are referenced objects from another schema called People
    • The Object Type that is being referenced from the People schema is called Employee

Currently, I've created an Asset field and can successfully load the Software object into it upon issue creation. Once loaded, I can see the attributes for the Primary Approvers.

I want to pull the email addresses of the Primary Approvers and populate a multi-user field with the values. (Note: this works when there is only a single value to pull)

However, I'm seeing the following result when I run logs for adding multiple emails:

[john.doe@email.com, jane.doe@email.com]

Jira is treating this as a single user rather than two separate emails which makes the automation fail.

Next I tried breaking this up into a list by plugging in the split() function. However, it still doesn't seem to change anything. I also tried modifying the result as if it were text by using the concat() function, but it also did not work as expected.


I'm trying to understand how I can get Jira to recognize multiple emails and then add them to the multi-user field. I'm scoured the available documentation and Community posts but none have pointed to the correct solution.

1 answer

1 accepted

0 votes
Answer accepted
Dan Tombs
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 26, 2023

Hi @Michael Andolfatto

If the asset attribute is always printing multiple emails separated by comma, then you could use smart values for looking before and after specific characters.

when it comes to entering the data you may be able to do it all in one edit action. Otherwise, edit the issue once, then re-fetch the issue and edit again using the smart value of the user field and add the next email address. 

I realise I may have just made that more confusing so let me know and I’ll add some screenshots

Michael Andolfatto
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.
July 27, 2023

Hey @Dan Tombs thanks for the reply. This is sort of what I ended up doing to get it working, but it feels pretty janky to me.

I had to create a variable to retrieve:

  1. The assets field storing the object that has approval data (Approval Type)
  2. The referenced objects stored in one of the object's attribute (Pr Named Appr)
  3. The referenced object's email address in another schema (Work Email)
{{issue.Approval Type.Primary Named Approver(s).Work Email}}

This is what provided me with the strange format from my original post:

[john.doe@email.com, jane.doe@email.com]

To get it to work, I had to strip it of the square brackets and whitespace:

{{primaryApprovers.replaceAll("[\[\]]", "").replaceAll("[ ]", "")}}

Then I had to break it into distinct pieces and plug each individually into the Edit Issue action of A4J:

{{primarryApproversList.split(",").get(0)}}
{{primarryApproversList.split(",").get(1)}}
{{primarryApproversList.split(",").get(2)}}

So it does work now but thankfully my requirements are only that there will ever be 1 - 3 approvers. If there's an easier way to just iterate over the list it would make this much more scalable.

Best,

Michael

Dan Tombs
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2023

Hey @Michael Andolfatto

As of right now there isn't this is the best way. I know it is annoying but at least you got there regarding the automation.

Dan

Michael Andolfatto
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.
July 27, 2023

Sounds good, just wanted to make sure I wasn't overcomplicating it unnecessarily. Appreciate the second set of eyes.

Michael

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events