Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project adds a dynamic preview feature to Service Catalog items, allowing users to see the full approval chain before submitting a request. It improves transparency, reduces confusion, and helps users understand who will be involved in the approval process based on their selections.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function onLoad() {
var ga = new GlideAjax('ApprovalChainHelper');
ga.addParam('sysparm_name', 'getApprovers');
ga.addParam('sysparm_item_id', g_form.getUniqueValue());
ga.getXMLAnswer(function(response) {
var approvers = JSON.parse(response);
var message = 'This request will be approved by: ' + approvers.join(', ');
g_form.showFieldMsg('requested_for', message, 'info');
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var ApprovalChainHelper = Class.create();
ApprovalChainHelper.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getApprovers: function() {
var itemId = this.getParameter('sysparm_item_id');
var userId = gs.getUserID();

var approvers = [];

// Example logic: fetch approval rules based on item and user
var ruleGR = new GlideRecord('sysapproval_approver');
ruleGR.addQuery('document_id', 80f8920bc3e4b2105219daec050131e3);
ruleGR.query();

while (ruleGR.next()) {
approvers.push(ruleGR.approver.name.toString());
}

return JSON.stringify(approvers);
}
});
Loading