Approvers Related List: Adding Selected Users via Modal on Incident Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 06:47 AM
Hello All,
I am currently working on Approvers related list on Incident form.
We need a 'Add' button on the related list of Approvers. After clicking on 'Add' it will open new window with list of active users from sys_user table. After selecting the users from the list and clicking on "Add Selected", the selected users should be added to the approvers list of the current incident.
We have written a UI Action script that shows the "Add" button to the approvers related list. After clicking on that "Add" we are getting list of active user. We can select users from that list, but we are not able to add them in approvers list as we don't have "Add Selected" button on the list which adds the selected users to the approvers list.
Does anyone have any idea of how we can make "Add Selected" button so that it will add the selected records to the approvers list.
We have used following scripts.
UI Action Script :
function openApprovals(){
var approverList = new GlideAjax('getApproverLIst');
approverList.addParam('sysparm_name','approverList');
approverList.getXMLAnswer(openListModalUser);
}
function openListModalUser(approvalUrl){
// render the modal
var userModal = new GlideModal('user_add_records');
userModal.setTitle(getMessage("Add Approvers"));
userModal.setWidth(1200);
userModal.setAutoFullHeight(true);
userModal.on('beforeclose', function(){
refreshRelatedApprovers();
});
ScriptLoader.getScripts('/scripts/incident/glide_modal_accessibility.js', function() {
userModal.template = glideModalTemplate;
userModal.renderIframe(approvalUrl, function(event) {
glideModalKeyDownHandler(event, userModal.getID());
});
});
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'styles/incident_glide_modal.css';
document.head.appendChild(link);
}
function refreshRelatedApprovers() {
GlideList2.get(g_form.getTableName() + '.' + g_list.getRelated()).setFilterAndRefresh('');
}
Script Include :
var getApproverLIst = Class.create();
getApproverLIst.prototype = Object.extendsObject(AbstractAjaxProcessor, {
approverList : function(){
var approvalUrl = "sys_user_list.do?sysparm_query=active%3Dtrue&sys_target=task";
return approvalUrl;
},
type: 'getApproverLIst'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 08:15 AM
I see out of the box there is an edit button that allows you to add/remove users from the list of approvers. Why are you trying to create something new when there is out of the box functionality for it already. The only difference is that it presents a list collector instead of popping a window were you have to select user by checking next to there name.
Best Practice is to always use out of the box functionality rather then trying to create something new. To me the list collector is much better. I get a lot of complaints about the popup like when you a CI's the the affected CI list on a change. The fact that you have to add the CI before you search for others really annoys users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 10:44 PM
Hello Brian,
Thank you for your reply.
Yes, we do have Edit button on the related list and we are able to add users from there. But the same buttons are not there for Incident form on Service Operations Workspace. We need to add approvers to Incident from Service Operations Workspace.
Can you tell me how we can add "Edit" button to Service Operations Workspace so that we can add approvers from there?
Thank you.