Generating Auto numbering based on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 08:22 AM
I have a custom table where a field is there called "function" with different dropdowns (Marketing, Finance, etc) and another string field called "GAP ID". So my requirement is below :
1. When a new record is created with Function "Finance" GAP ID will be autogenerated like: "FINI001a" where the 001 part will be auto-incremented for the next Finance function record.
2. When a new record is created with Function "Marketing" GAP ID will be autogenerated like: "MAR001a" where the 001 part will be auto-incremented for the next Marketing function record (002,003 etc).
So I have tried with a before-insert business rule with the below details :
var now_GR = new GlideRecord('u_test_cmdb_table');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 03:28 PM
My test case is posted. change the "if" to "while" in line 6 from above, if more than one record matches the query, and remove line for with the 'setLimit()'. So each record that meets the previous query is returned.