Forums

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

Jira automation rule to match asset value then compare and create

Shi
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!
July 17, 2025

Hi everyone 

I’ve created an automation where, when a user creates an issue and enters a device name in a custom field, the automation checks the IT hardware asset sheet for a matching device name.

  • If the device name matches an existing asset, the automation simply adds a comment saying the device name matches and takes no further action.

  • If the device name does not match, the automation creates a new asset record with that device name.

My current challenge is adding a condition to validate the device name format. For example, if the device name entered doesn’t follow the required pattern (like starting with “ABC” followed by digits, e.g., ABC1245), the automation should fail, notify the user that the device name is invalid, and not create a new asset.

I’m struggling to design the correct structure using “If → Else” conditions to make this work properly.

 

this: is the condition 
{{issue.customfield_xxxx.trim.match("^ABS\\d{5}$")}}

would be much grateful for any ideas I can write down the whole structure i have 

 

 

StepActionDetails
TriggerIssue Created or Field ChangedDevice name field
ActionLookup rows/issuesFilter: deviceName = {{issue.fields.deviceName}}
Condition (if/else)If lookup count > 0Device exists → Do nothing or comment
ElseCreate assetUse device name from issue
 Add comment"New asset created with name: ..."

 

2 answers

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Champion
July 17, 2025

Hello @Shi 

Welcome to the Atlassian community.

I recommend that you use an Else-if to validate the name provided in the issue against a regex. If the name is acceptable, execute the Create Object action. Then the final Else handles reporting that the name was invalid.

Screenshot 2025-07-17 at 1.40.04 PM.png

Shi
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!
July 17, 2025

That’s strange I am not able to see more than one else in an IF branch - so using IF or else 

gives me only one else and this is my main problem I wonder if this is the license am using? 

Like John Funk likes this
Trudy Claspill
Community Champion
July 17, 2025

No, there is no difference in this functionality based on the license.

Can you provide a screen image of what you see?

Like John Funk likes this
Shi
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!
July 20, 2025

Screenshot 2025-07-21 151228.pngScreenshot 2025-07-21 151239.pngthis is all I can see 

Shi
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!
July 20, 2025

FYI am on the premium plan 

so not sure if that feature is only on enterprise plan 

Shi
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!
July 20, 2025

I tried to add same structure manually could not find a way but - when I ask the jira AI to do it by if else if then else than that worked 

Like Trudy Claspill likes this
Trudy Claspill
Community Champion
July 21, 2025

The manual way:

At the point where you want to and the If-ElseIf-ElseIf-Else:

Click Add component

Screenshot 2025-07-21 at 12.51.12 PM.png

Click IF: Add a condition

Screenshot 2025-07-21 at 12.51.32 PM.png

 

Click IF or ELSE: Add condition options

Add a Condition

Screenshot 2025-07-21 at 12.53.56 PM.png

 

Click the Add Component button directly below that IF in the diagram on the left and add an action

Screenshot 2025-07-21 at 12.54.20 PM.png

 

Click the Add Else button below that.

Screenshot 2025-07-21 at 12.56.57 PM.png

Screenshot 2025-07-21 at 12.57.43 PM.png

Click the Add Condition button in the dialog on the left, then select a condition. Notice that a new Add Else button appears in the diagram on the left.

Screenshot 2025-07-21 at 12.59.14 PM.png

Shi
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!
July 21, 2025

This clears a lot 

sorry for the delay 

I have attached a screenshot of the layout iv done but the automation stills fails as the last else still creating an object in jira asset regardless what is the input so the idea that if if I add anything other than ABC followed by 6 numbers I only get that comment device name is wrong - and nothing is added in the asset , but if the user enters a correct device name then automation should lookup this device if it match I get comment saying it match and it won’t add a new device name

in case the device name entered correct and it does not match what’s in the asset sheet the automation then should add a new device name and give me that comment that device name was added successfully 

so here am using only one custom field where the user enters the device name 

Screenshot 2025-07-22 093943.pngScreenshot 2025-07-22 093925.png

Shi
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!
July 21, 2025

Thanks Trudy 

your lay out was actually perfect 

so first trigger value change with custom field 

then 

IF 

match regex 

lookup in asset 

then 

else if 

Lookup object greater than 0 

then add comment device already exists 

then 

else 

then create object in schema 

then comment wrong device name 

that worked perfectly 

Trudy Claspill
Community Champion
July 21, 2025

Hello @Shi 

Just to make sure there has not been a misunderstanding, can you provide screen images that show your entire rule from the beginning? The images you showed in you next to last reply and the text you put in your last reply indicate a flow that does not match my recommendation, and I am concerned that it will not work as you intend.

I think the "If match regex then lookup objects" should not be part of the IF-Else block.

Screenshot 2025-07-21 at 6.28.40 PM.png

Shi
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!
July 21, 2025

IMG_2011.png

Like Trudy Claspill likes this
Trudy Claspill
Community Champion
July 22, 2025

Thank you @Shi . The structure of your rule looks correct.

I suggest changing one last thing. In this comparison:

Screenshot 2025-07-22 at 7.26.41 AM.png

Instead of {{lookupObjects.size}} I recommend that you use 

{{lookupObjects.size|0}}

That says if lookupObjects.size is null then use "0" for the comparison. Comparisons to null can have unexpected results.

Like Bill Sheboy likes this
3 votes
arielei
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 17, 2025

Hello @Shi 

Dont struggle with it, do the following:
Set a validation on the Name attribute in your asset object using regex.
Then use your automation to check if it was able to create the object, and if not, send a message to the requester.

 

much more simple and clear.

Trudy Claspill
Community Champion
July 17, 2025

@arielei 

That won't work.

When the validation fails and the object can't be created, that will cause an error to occur in the rule and none of the steps after that will be executed.Screenshot 2025-07-17 at 1.27.58 PM.pngScreenshot 2025-07-17 at 1.27.43 PM.png

Like John Funk likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events