Problems with the automatic creation of Assets Objects due to leading zeros?

Jannick Bettighofer January 26, 2025

Hi Community,


Introduction:
New assets objects are to be created through automation. Each object has a unique whitelist ID. Before a new assets object can be created, the next free whitelist ID must be found. A whitelist ID is structured as follows: SW-0001, SW-0002, SW-0003, etc.

Problem:
Now my problem is that the automation does not create a correct whitelist ID.
I tried the following lookup by creating a variable:
{{lookupObjects.max(Whiteliste-ID.substringAfter("SW-").asNumber)}}

In the second step, I then calculate with the variable +1:
SW-{{#=}}{{Whitlist}} + 1{{/}}

Question:
I now have the following problem: either the whitelist ID SW-1 or SW- is generated. Is the problem here with the leading zeros? How should I incorporate these into the lookup/calculation?


 

Thank you in advance for your help!

1 answer

0 votes
Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 26, 2025

@Jannick Bettighofer -

Based on my experience, you may need to have another variable (string based - 000) where you pre-append it to your whitlist ID (number).  However, this may create another issue where if your whitlist ID ends with double digit (i.e. 10), then the overall SW- value will be setup as SW-00010 instead of SW-0010.

You may want to take your whitlist value convert it to string, then manipulate it as a string first, then store it back to your original whitlist value.  I believe it is an issue with the leading 0's results that you want to achieve.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

I would also recommend that you should reach out to Atlassian Support (https//support.atlassian.com) for their technical assistance.

Sorry.

Best, Joseph Chung Yin

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