Detect if setWorkflow(false) was used

Nisar3
Giga Guru

I've the following in a script include

function: doSomething(sysid){
	var inc = new GlideRecord('incident');
	if(inc.get(sysid)){
		var getSomeOtherValue = this.getOtherValue();
		inc.setValue('xxxx', 'yyyy');
		inc.setValue('zzzz', 'aaaa');
		if(getSomeOtherValue){
			inc.setWorkflow(false);
		}
		inc.update();
		
		if(<check if setWorkflow is set to false on the inc object>){
			this.doSomethingExtra();
		}
	}
}

Is there a way to check the if() condition above?

 

I know I can simply do this

function: doSomething(sysid){
	var inc = new GlideRecord('incident');
	if(inc.get(sysid)){
		var getSomeOtherValue = this.getOtherValue();
		inc.setValue('xxxx', 'yyyy');
		inc.setValue('zzzz', 'aaaa');
		if(getSomeOtherValue){
			inc.setWorkflow(false);
		}
		inc.update();
		
		if(getSomeOtherValue){
			this.doSomethingExtra();
		}
	}
}

but I was wondering if I can verify that by any OOTB method on the GlideRecord class. For eg: We have inc.isValidRecord() method, so is there a inc.isSetWorfklowFalse() or something similar?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Nisar3 

setWorkflow(false) is used to avoid business rule, notifications, flow when record is inserted or updated and is applied in real-time

there is no way to check what you are asking

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Nisar3 

setWorkflow(false) is used to avoid business rule, notifications, flow when record is inserted or updated and is applied in real-time

there is no way to check what you are asking

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

Maik Skoddow
Tera Patron
Tera Patron

Hi @Nisar3 

 

as the GlideRecord object can be modified and extended like any other javascript object you can incorporate your own method to achieve it

 

MaikSkoddow_0-1744952430944.png

Maik