duplication of an auto generation field when users create at same time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 12:43 AM
Hi
when users are trying to create an asset, the asset tag is autogenerated, but there is an issue which is rarely happening when users try to create an asset at same time , asset tag is being duplicated i.e 2 assets are having same asset tag. can anyone suggest the solution for it.
How code is written:
we are calling a scriptinlcude inside a business rule for asset tag generation.
solutions suggested in other forums but did not understand or get the way how it shoud be done:
- lock the counter table if one is using it
- increase counter immediately if one query is happening
- pipeline users in queue - fifo manner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 01:02 AM
So you need to debug and understand that script include and business rule
What debugging have you done so far?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:22 AM
i debugged the code it's just assigning the asset tag basing on few conditions but i want to know how we can
stop creating duplicate asset tags when 2 users try to create an asset?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:28 AM
why 2 users are creating same asset at same time?
you can validate if the asset tag is already being used before assigning it
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 02:53 AM
Hi @Ankur Bawiskar
sorry for late reply, actually the asset tag is auto generated depending upon few conditions and now when we are calling the script include from before business rule where the code is written in script include, we have counter field which increases everytime an asset is created and the counter field is appended in the end of asset tag, now when 2 users are creating at same time and the condition of the assets which are being created match we are getting same asset tag in that case, maybe because counter which is being appended in the end is same too , also sys_created is also same for newly created assets with same seconds too