Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Remove an item from custom variable

Zaine Abaddin August 27, 2025

The goal:

Take all mentions from the last comment, filter out the issue's current assignee if they are added and insert the users mentioned into a custom field.

The approach:

split the mentions from the comment into a custom variable and use that to insert into custom field

The problem:

I'm struggling to filter out the current assignee from the array

I've tried:

I know i can use advanced branching but as this is part of a bigger autmation, this isn't an option.

I've tried looping through array and filtering out the assignee but it doesn't work.

I've tried using different functions like .replace .remove but no luck with any of these.

I don't even know at this point if I'm approaching this in the right direction as I don't really work with smart values.

Can someone guide me in the right direction?

This is what is being used to create the custom variable:

{{issue.comments.last.body.replaceAll("\\n", "").split(" ").substringBetween("[~accountid:", "]")}}

1 answer

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.
August 27, 2025

Hi @Zaine Abaddin 

For a question like this, context is important for the community to help.  Please post the following:

  • what version of Jira are you using: Cloud, Server, or Data Center
  • for Cloud, what type of project is this: company-managed, team-managed, JPD, etc.
  • an image of your complete automation rule in a single image for continuity
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution
  • explain what is not working as expected and why you believe that to be the case

Until we see those...

 

From what you describe, there are at least a couple of ways to do this: 

  1. After extracting the accountId values from the comment mentions, using inline iteration and the replace() function, substitute the issue.assignee.accountId value with an empty string, and then clean up to remove any empty / left over spaces in the list with match("^(.++)")
  2. Again, extract and iterate the accountId values, and using inline iteration, use a dynamic regular expression to exclude the assignee's value.  That is similar to methods used in this article: https://community.atlassian.com/forums/Automation-articles/Automation-concepts-Find-Overlaps-Between-Lists/ba-p/3045704

I recommend using the first method as I have observed inconsistent results with automation rule support of regular expressions which do not contain a string.

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events