gsft submit() Ui action method not working in LIST View
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 05:32 AM - edited 09-27-2023 11:17 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 05:56 AM
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') {
...
}
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 10:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2023 06:49 AM
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?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/