- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2020 08:39 AM
I am trying to create a portal pop-up window (modal) that displays when a user accesses a CLOSED task record in portal (incident, request item, change, etc.). This modal should instruct the user that the record they are accessing is closed and provide them with instructions on what to do next.
I am unable to craft the proper onLoad client script to trigger the modal. I am wondering if anyone else has something similar they could share...
Thanks
Solved! Go to Solution.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2020 01:46 PM
Here you go. This is tested an working on an INC record.
Server Script:
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
var id = '';
if(input.action === 'checkRec'){
id = $sp.getParameter('sys_id');
}
data.active_record = isRecordActive(id);
function isRecordActive(sysID){
var active = '';
var task = new GlideRecord('task');
task.get(sysID);
active = task.active;
return active.toString();
}
})();
Client Script:
function(spModal) {
/* widget controller */
var c = this;
var activeRecord = '';
c.server.get({
action: 'checkRec'
}).then(function(response){
activeRecord = response.data.active_record;
if(activeRecord == 'false'){
spModal.open({
title: 'This is a test title for false record',
message: 'This is a test message.',
buttons: [{label:'OK', primary:true}]
});
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2020 05:40 AM
oh yeah...bang on...
works for all types of tasks, so it's extendable to RITM records !
Thanks tons for the help !!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2020 10:28 AM
No problem!