SERVICENOW Improving the prevent duplicate number business rule - unique numbering / prevent duplicate number
SERVICENOW Improving the prevent duplicate number business rule - unique numbering / prevent duplicate number
new reference - search on enforcing unique numbering
---
old reference:
as per the approach here:
here is a slightly improved version of the bus rule
description:
use this script to test:
/*var grInc=new GlideRecord('incident');
grInc.newRecord();
grInc.short_description='test RDS';
grInc.number='INC5150xxx'; //--an existing number
gs.print(grInc.insert());*/
script:
(function executeRule(current, previous /*null when async*/ ) {
//var curNum = current.number + '';
var curNum = current.getValue('number');
if (curNum) {
var recordClass = current.getRecordClassName();
var now_GR = new GlideRecord(recordClass);
now_GR.addQuery('number', curNum);
now_GR.query();
if (now_GR.getRowCount() > 0) {
var newNum = getNextObjNumberPadded();
//gs.addInfoMessage("The number " + current.number + " was already used by another " +
//recordClass + ". The " + recordClass + " number has been changed to " + //newNum);
var sFeedback = gs.getMessage("The number {0} was already used by another {1}. The {1} number has been changed to {2}", [
current.number,
recordClass, newNum
]);
gs.addInfoMessage(sFeedback);
//current.number = newNum;
current.setValue('number', newNum);
}
}
})(current, previous);
I admire this article for the well-researched content and excellent wording. second phone number line2 app services. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.
ReplyDeleteI always check this type of advisory post and I found your article which is related to my interest. This is a great way to increase knowledge for us. Thanks for sharing an article like this.Enterprise Wireless Solutions
ReplyDeleteYou have provided valuable data for us. It is great and informative for everyone. Read more info about at&t tv and internet service usa Keep posting always. I am very thankful to you.
ReplyDeleteI just need to say this is a well-informed article which you have shared here about hoodies.Business Phone System South Carolina It is an engaging and gainful article for us. Continue imparting this sort of info, Thanks to you.
ReplyDeleteYou have done good work by publishing this article here.Virtual Number UAE I found this article too much informative, and also it is beneficial to enhance our knowledge. Grateful to you for sharing an article like this.
ReplyDeleteMake sure you know when your card expires since some cards have the option of having their expiration dates extended. SIM Card for IoT
ReplyDelete