if state is inprogress then shortdescrition should applied other wise it should Abort
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 01:44 AM
if state is inprogress then shortdescrition should applied other wise it should Abort the action?
var gr=new GlideRecord('incident');
gr.addQuery('number','INC0000059');
gr.query();
if(gr.next())
{
gr.state='2';
gr.short_description="if condition is applied1";
}
else
{
current.setAbortAction(true);
// gr.setWorkflow(false);
//gr.autoSysFields(false);
gr.update();
}
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 01:49 AM
what's your actual business requirement?
what script did you share? where did you write it?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 02:08 AM
Hello @praveensnow9984, just looking at your script, I'm wondering about your actual use case. Nevertheless, i think below modified script should help you update short description and abort otherwise
var gr=new GlideRecord('incident');
gr.addQuery('number','INC0000059');
gr.query();
if( gr.next() ){
if ( gr.state == 2 ){
gr.short_description='if condition is applied1';
gr.update();
}
else
current.setAbortAction(true);
}
Regards,
Nishant