How to add a Checkbox in spModal() script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 11:26 PM - edited 08-30-2023 11:27 PM
Hi Everyone,
I have a client script that opens spModal() window when the state of the record is changed. Now i need to include a checkbox message to the script,but couldnt achieve this with 'checkbox' attribute. The second function() for the "Evidence not Required" button is not working also. Kindly help on this.
Client Script:
OnChange of State
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ajax = new GlideAjax('SP_AuditUtils');
ajax.addParam('sysparm_name', 'getFieldValues');
ajax.addParam('sysparm_id', g_form.getUniqueValue());
ajax.addParam('sysparm_table', g_form.getTableName());
ajax.addParam('sysparm_fields', 'state');
ajax.getXMLAnswer(function(answer) {
answer = JSON.parse(answer);
if (g_form.getValue('state') == 'closed' && answer.state != 'closed') {
//if(newValue == 'free') return;
spModal.open({
"title": "Auditor Evidence Confirmation",
"message": "Have you attached an email which confirms that you can close this Finding?",
"checkbox":"I hereby confirm this Finding can be closed and evidence has been attached",
"buttons": [{
label: "✔ Confirm",
primary: true
},
{
label: "Evidence not Required",
simple: true
},
{
label: "✘ Close",
cancel: true
}
],
"backdrop": "static",
"keyboard": false
}).then(function() {
g_form.setValue('comments', 'I hereby confirm this finding can be closed and evidence has been attached');
g_form.save();
},
function() {
g_form.setValue('comments', 'Evidence is not needed to close this Finding');
},
function() {
g_form.setValue('u_substate', '');
});
}
});
}
Thanks,
Lavanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 04:42 AM - edited 08-31-2023 04:42 AM
According to the latest documentation 'checkbox' is not a supported object for spModal:
https://developer.servicenow.com/dev.do#!/reference/api/vancouver/client/SPModal-API#SPM-confirm_S
If helpful please mark as Helpful/Correct
Regards
Paul