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
Step | Action | Details |
---|---|---|
Trigger | Issue Created or Field Changed | Device name field |
Action | Lookup rows/issues | Filter: deviceName = {{issue.fields.deviceName}} |
Condition (if/else) | If lookup count > 0 | Device exists → Do nothing or comment |
Else | Create asset | Use device name from issue |
Add comment | "New asset created with name: ..." |
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, there is no difference in this functionality based on the license.
Can you provide a screen image of what you see?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.