when description is empty abort the action on incident form.

Sagar_pawar
Tera Contributor

Hello All,

I want to check current description is empty or not if its empty is want to abort action .

Thank You.

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

current.addNullQuery(current.getValue('description'));
current.query();
if(current.next())
{
current.setAbortAction('true');
gs.addInfoMessage(current.number+" description Empty");

}
else{
gs.addInfoMessage("u can submit record");
}

})(current, previous);

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi @Sagar_pawar ,

If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

7 REPLIES 7

Pavankumar_1
Mega Patron

Hi @Sagar_pawar ,

Create before business rule and insert/ update and try below code

 

 

(function executeRule(current, previous /*null when async*/ ) {
var inc = new GlideRecord('incident');
    grinc.addNullQuery('description');
    grinc.addQuery('number', current.number);//compare the current number
    grinc.query();
    if (grinc.next()) {
        current.setAbortAction(true);
    } 
})(current, previous);

 

 

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Pavankumar_1
Mega Patron

Hi @Sagar_pawar ,

If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Pavankumar_1
Mega Patron

Hi @Sagar_pawar ,

If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar