gsft submit() Ui action method not working in LIST View

Mark Wood
Tera Contributor

Hello Exeprts,

I have written below script in UI action in that I am trying to call scheduled job in UI action.

but my UI action gsftsubmit script not working.please guide me on this thank you.

 

 

 

function cleanup() {
	
	
    var c = confirm("Are you sure you want to perform cleanup?");
	alert(c);
    if (c=='true') {
       gsftSubmit(null,g_form.getFormElement(),'demo');

        }
	else if(c=='false') {
        // User cancelled the operation
        alert("Cleanup operation canceled.");
    }
	
	
}
//var gr=new GlideRecord('u_ma_frm_event');
//			gr.addQuery('u_ma_fld_state','closed');
	//		 gr.query();
		//	gr.setWorkflow(false);
			//if(gr.getRowCount()>0)
				{
					gs.cacheFlush();
           // gr.deleteMultiple();
					var rec = new GlideRecord('sysauto_script');


rec.get('sys_id', 'fff61e5d1be5b190a72cfdd2cd4bcb37');


SncTriggerSynchronizer.executeNow(rec);
				}

 

3 REPLIES 3

Slava Savitsky
Giga Sage

Your variable "c" is a boolean and comparing it to a string makes no sense. Neither your "if" nor your "else if" condition is satisfied, no matter which button the user clicks in the alert popup. To make it work, use:

if (c == true) {
...
} else if (c == false) {
...
}

instead of:

if (c == 'true') {
...
} else if (c == 'false') {
...
}

Hello @Slava Savitsky ,

Still, it's not working any suggestions?

thank you

If you place an alert() inside the IF block just before the gsftSubmit() call, does the alert get displayed?

 

Does the 3rd argument of your gsftSubmit() call match the value in the "Action name" field of your UI Action?

 

If you place a gs.log() statement before gs.cacheFlush(), do you see an entry written to the system log?