Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Prevent Creation of incidents with the same short description

Not applicable

Prevent Creation of incidents with the same short description

1 ACCEPTED SOLUTION

sreeshsurendran
Tera Guru

Hi @Community Alums , you can use before Business Rule with insert and update checked where condition will be 'short description changes'

 

Here is the script : 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var shortDescription = current.short_description;
    var gr = new GlideRecord('incident');
    gr.addQuery('short_description', shortDescription);
    gr.query();
    if (gr.hasNext()) {
        gs.addErrorMessage('Short Description already exists');
        current.setAbortAction(true);
    }
})(current, previous);

 

Note : you can replace hasNext() with next() if you want to show the Incident Number on the error message.

 

Mark this as solution if it's working 🙂

View solution in original post

6 REPLIES 6

Not applicable

Not a real requirement just a use case that I was implementing.

just to test, meaning not for real?
I don't see any value in this restriction why would anyone like this? (What is the use case?)