Forums

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

toLowerCase() on loop value not working

Owain_Esau
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 20, 2025

Hi,

Im trying to create an automation rule that looks at the subject or description of emails for key terms that are defined as an asset. The automation rule should then update the work item and update the queue field and assign then assign a user to the ticket. This is all working but only when the subject field in the asset is all lower case.

What i wanted to do was this:

"type": "jira.comparator.condition",
    "value": {
        "first": "{{issue.summary.toLowerCase()}}",
        "second": "{{businessrule.Subject.toLowerCase()}}",
        "operator": "CONTAINS"
    },

Where businessrule is the name of the loop value, but when using toLowerCase on the loop value it clears it so tries to match against "" and always passes. What I've ended up having to do is enter the subject in the asset to be all lower case and remove the toLowerCase() function call on the second value shown above.

Is there any way around this? In its current state if anyone were to add a new asset object with an uppercase letter it would always pass and result in every ticket going to the same queue.

2 answers

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.
May 21, 2025

Hi @Owain_Esau -- Welcome to the Atlassian Community!

As @Marc - Devoteam describes, we need to see your automation rule and audit log details to provide more context for the question.  Including, what type of branch are you using?

 

Until we see those...

If the rule branches over object / asset data, it is possible there is a timing problem looking up the value fast enough before the toLowerCase call.  The solution for that would be adding an extra step to fully evaluate the asset value, storing it in a variable first:

  • branch: over the objects, with a branch variable named businessrule
    • action: create variable
      • name: varSubject
      • value: {{businessrule.Subject}}
    • smart value condition:
      • first value: {{issue.summary.toLowerCase()}}
      • condition: contains
      • second value: {{varSubject.toLowerCase()}}
    • todo

You may also want to confirm the case is correct for Subject, versus subject as the attribute the rule sees.  This could be done by writing the value to the audit log inside the branch.

 

Kind regards,
Bill

0 votes
Marc - Devoteam
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.
May 21, 2025

Hi @Owain_Esau 

Whenever you ask for help with an Automation Rule it will help us to help you if you provide:

1. what type of project is this (e.g., company-managed, team-managed, etc.), 

2. images that show your complete rule.

3. images showing the details of any relevant actions/conditions/branches.

4. images showing the Audit Log details for the rule execution.

5. Explain where the issue is.

These questions are not for not willing to help, but to have community members understand on how automation works.

In you question you mention asset, what do you mean by this, assets in the term of assets in JSM?

Just a question, as terminology can throw people off.

Owain_Esau
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2025

Hi Marc,

Here are the images for the rule, I was wanting to split this into two or three rules using incoming webhooks and web requests to trigger each but we have some IP whitelisting issues atm so for now its all in the one.

1. what type of project is this (e.g., company-managed, team-managed, etc.), company-managed

2. images that show your complete rule. Below

3. images showing the details of any relevant actions/conditions/branches. Below

4. images showing the Audit Log details for the rule execution.

log.png

5. Explain where the issue is.

The images below show the updated rule without the toLowerCase call (ive updated the rule to not use it but added regex validation on the asset attributes which is not ideal) The issue seen in the log above "Comparing testing with ''" happens when i change this comparison to use {{businessrule.Subject.toLowerCase()}}.

Which results in it always passing the check.

issuearea.png

1.png2.png3.png4.png5.png6.png

Marc - Devoteam
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.
May 22, 2025

Hi @Owain_Esau 

I concur with @Bill Sheboy 

Create a variable based on the businessrule.Subject, within the variable to information will be stored as text and then use the toLowerCase on the variable

Suggest an answer

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

Atlassian Community Events