Jira Automation using smart value to remove backslash doesnt work

Aaron Pavez July 12, 2022

Hi and good day to all!

Im trying to use this smart value to remove a backslash {{issue.customfield_10135.remove("\")}}

1) I bring from SF the last chatter (custom field rich text) into a custom field(paragraph text).

2) this is the result. Since the field is rich text it comes with a set of backslashes that I want to remove.

2022-07-12 20_56_43-[CSF-265] 76jhgfjf - Jira — Mozilla Firefox.png

3) This is the automation to remove the backslash

2022-07-12 20_57_46-Automation - Jira — Mozilla Firefox.png

2022-07-12 20_58_39-Automation - Jira — Mozilla Firefox.png2022-07-12 20_58_49-Automation - Jira — Mozilla Firefox.png

4) so I'm using the .remove smart value. but it won't work. it doesn't remove the backslash. and I get this error:

2022-07-12 20_59_52-Automation - Jira — Mozilla Firefox.pngAny ideas on how to do it are appreciated!

 

Thanks!!

1 answer

1 vote
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.
July 13, 2022

Hi @Aaron Pavez 

The backslash is the escape character so you need to double it for use in the expression.  Please try this:

{{issue.myField.remove("\\")}}

Kind regards,
Bill

Aaron Pavez July 13, 2022

Hi @Bill Sheboy 

Tried that, but no luck, got some errors.

Failed to get value for customfield_10135.remove("\​\"): {{customfield_10135.remove("\​\")}}
Failed to get value for issue.customfield_10135.remove("\​\"): {{issue.customfield_10135.remove("\​\")}}

 Thanks and Regards

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.
July 13, 2022

That is curious...I just retested it and it worked for the Description field.

If you are trying to get the data from the last comment to save, perhaps try this:

{{issue.comments.last.body.remove("\\")}}
Like Aaron Pavez likes this
Somesh Laturia November 8, 2024

Hi @Bill Sheboy May you please guide me  on - How do we remove COMMA from {{sprint.goal}} field? I tried remove(",") and replaceAll(","," ") functions and also followed the tricks mentioned on some google links.

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.
November 9, 2024

Hi @Somesh Laturia -- Welcome to the Atlassian Community!

First thing: this is a very old thread, and so I recommend creating a new question, perhaps linking back to this thread.  That will ensure the maximum number of people see the question to offer suggestions.

When you post your question, remember to include images of the complete rule, the action where you are trying to remove the comma, and of the audit log details showing the rule execution.  Those will provide context for the community to help.

 

Until we see your new question...what is the trigger / context for your rule? 

When the trigger is sprint-related (e.g., Sprint Started), the smart value {{sprint}} only contains one value, and {{sprint.goal.remove(",")}} should work.

But if your rule is using issues with the smart value, such as with {{issue.sprint}} the value could be a list of sprints the issue has been in.  This will result in any comma removal not working as you expected.

For example, let's assume an issue has been in these sprints with their associated goals:

  • sprint A
    • this was a previous sprint
    • goal: Here is the goal, of the sprint
  • sprint B
    • this is the current sprint
    • goal: Sprint B's goal is here

This smart value expression would return the list of values removing the commas in the goal but not between the list items:

{{issue.sprint.goal.remove(",")}}

--returns this:
Here is the goal of the sprint, Sprint B's goal is here

Assuming you only wanted the goal for the current, active sprint, the list could be filtered by the state, and then remove the comma:

{{#issue.sprint}}{{#if(equals(state,"active"))}}{{goal.remove(",")}}{{/}}{{/}}

 

Kind regards,
Bill

Like Somesh Laturia likes this
Somesh Laturia November 9, 2024

@Bill Sheboy Thank you so much for warm welcome such a detailed answer.

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events