Where can I find docs for "sys_action"????

DrewW
Mega Sage
Mega Sage

I am trying to do some client scripting, specificly making some fields manditory when you close an Incident. I found a sample script in the Wiki but it does not work. The reason it does not work is because sys_action.value returns bbddb6bbc0a81823adf328cbbba or something like it and the script is looking for "incident_close". So I am looking for documentation of what sys_action is supposed to do, it properties and any methods it may have.

The Wiki is very lacking in this area.

7 REPLIES 7

Ivan Martez
ServiceNow Employee
ServiceNow Employee

Can you post the script that you are developing?


It was a sample script in the Wiki and it did not work because of what the sys_action was returning.

function onSubmit() {
var form = gel('incident.do');
var sClsBtn = form.sys_action;
var inc_state = g_form.getValue('incident_state');

alert(sClsBtn.value);

if (sClsBtn.value == 'close_incident' || inc_state == '6' || inc_state == '7') {
var close_note=g_form.getValue('close_notes');
if (close_note == '') { ''
alert('Close Notes are mandatory!');
g_form.setMandatory('close_notes', true);
return false;
}
}
}


Ivan Martez
ServiceNow Employee
ServiceNow Employee

Try this script.

function onSubmit() {
// get the name of our form
var formName = g_form.tableName + ".do";
// get the form
var form = gel(formName);
var action = form.sys_action.value;
var state = '6';
if(action == 'close_incident'){
state = '7';
}


if(action == 'close_incident' || action == 'resolve_incident'){
g_form.setValue('incident_state',state);
g_form.setDisplay('close_notes',true);
g_form.setDisplay('close_code',true);
g_form.setMandatory('close_notes',true);
g_form.setMandatory('close_code',true);

if (g_form.getControl('close_notes') && g_form.getControl('close_code'))
if(g_form.getValue('close_notes') == '' || g_form.getValue('close_code') ==''){
return false;
}
}
}