Duplication of an asset tag which is auto generated

saibharath
Tera Contributor

Hi everyone

When A and B try to create 100 assets each at the same time through bulk either via backend or portal, asset tag is for few assets is being duplicated.

We calling the script include from before business rule where the code is written in script include, we have count field which increases everytime an asset is created and the count value is appended in the end of asset tag, now when A and B are creating assets at same time and the condition of the assets which are being created match we are getting same asset tag, i.e both A and B are coming to script include at the same time and for both A and B count is being increased at same time and it is being appended in the end of asset tag which is result of duplication. 

2 REPLIES 2

Tai Vu
Kilo Patron
Kilo Patron

Hi @saibharath 

It is possible to avoid this by implementing a simple validation step to check whether the Asset Tag already exists in the system or not?

Example: Before accepting a new Asset Tag, you could perform a query on the asset table with the newly generated Asset Tag using a function like hasNext(). If the query returns true, indicating that the Asset Tag already exists, you can then re-generate a new Asset Tag.

This way, you can ensure that Asset Tags are unique and avoid any potential conflicts.

Tried this method, but even query to asset table happens at the same time (which again gives duplicates) since A and B have tried to create assets at the same time.