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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there anything that Jira automation can do with number processing? Edited

Callum Carlile Community Leader Aug 13, 2020

Hi all,

We have tasks which are automatically created when a new line is added in Excel (using Zapier). One of the fields input into Excel is Record ID and usually looks something like A01723, and this number is pulled into the Jira task summary as well as a separate custom field. We also have auto-allocation rules in place to assign these tasks to users in a role upon creation.

Sometimes if there's multiple Excel records for the same customer, the Record ID will be A01723/001, A01723/002 etc. We would like to make it so these tasks are assigned to the same user, which would be based off the first 6 characters of the Record ID.

Any automation help at all would be massively appreciated!

 

1 answer

0 votes
Daniel Eads Atlassian Team Dec 01, 2020

Hey Callum,

I think we can mock up a rule for you, but first I want to confirm this is essentially what you need:

  1. Check to see if it's a multi-part record by looking for the /001 portion in the record ID custom field
  2. If it's not multipart, simply pass it along to your normal assignment action
  3. If it is multipart, check to see if any issues already exist in the project with the same record ID custom field value
  4. Assign the issue to the same assignee as any other issues with a matching record ID (again, based on the first six characters) - otherwise pass it to your normal assignment action

For a preview, we can use the length() function to see if the custom field is longer than 6 digits (to see if it's multipart) or use the match() function to check for the slash. The substringBefore() function could get just the digits before the / separator for comparison.

Let me know if this is about on the track of what you need, and we can mock it out into full rules!

 

Cheers,
Daniel

Callum Carlile Community Leader Dec 02, 2020

Hi @Daniel Eads, thanks for your reply - you're spot on with your description, this sounds exactly what we're looking for :)

Callum Carlile Community Leader Dec 10, 2020

Hey @Daniel Eads, are the any updates on the above? Really keen to see how this rule will work :)

Thanks for your patience, I was out a few days! For the purposes of this example, I am assuming your custom field for the record is called recordID. Given this is a fairly long/complicated rule to set up, you can download the rule here and then just import this rule into your own instance (rule import/export instructions here).

The first part isn't so tricky:

  1. Trigger: Issue Created
  2. Action: Create Variable
    • Variable Name: multi
    • Smart value: null
  3. Action: Create Variable
    • Variable Name: multiassignee
    • Smart value: null

      part1.png

      So far so good! Now to the first If block:

  4. Action: If/else block
    • Condition type: Advanced compare
    • First value: {{recordID}}
    • Condition: contains
    • Second value: /

      There are a few different ways you can test for a multipart record based on your format of "A12345/001" - this is the simplest :)
  5. Action: Create variable
    • Variable Name: multi
    • Smart value: {{issue.recordID.split("/").first}}

      Here we fall back on using the / character to denote a duplicate row/record. The advantage of using the split and first vs something like a string index is that it will scale up, should your records ever be more than 6 characters in the future (or if the format otherwise changes somehow)
  6. Action: Lookup issues
    • JQL: recordID ~ "{{multi}}*" and issuekey != {{issue.key}}

      Here we look for other previously-created issues with the same recordID so we can get the assignee
  7. Action: Create variable
    • Variable Name: multiassignee
    • Smart value: {{lookupIssues.assignee.first}}

      The lookup issues function returns an array; we need to use .first here to get a single user value. If there's no previously created issue (e.g. this issue is /001 and there's nothing before it), this value becomes Empty (the value, not the word 'empty')

      Now, on to the second If/else block!

      image.png
  8. Action: If/else block
    • Condition type: Advanced compare
    • First value: {{multi}}
    • Condition: does not equal
    • Second value: null
    • Condition type: Advanced compare
    • First value: {{multiassignee}}
    • Condition: does not equal
    • Second value: <leave this blank>
  9. Action: Assign issue
    • Assign issue to: Smart value
    • User: {{multiassignee}}
  10. Else
  11. Action: Assign issue
    • I've put Automatic here, but this is the point where you put in any existing assignment rules you have already.


And there you have it! Again, given the rule complexity, I do advise downloading the JSON from here , importing it, and then updating steps 4 and 6 with your custom field name, then modifying step 11 for your normal assignment rules.

Like Callum Carlile likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you