- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 11:29 AM
When click the "Request Approval" button is not working for Retro and Emergency change forms.
UI Action for "Request Approval":
Onclick: checkgrp();
Condition : current.isValidRecord() && current.state == '10' && new HideRequestApproval().groupHasNoMembers(current.u_approval_group) && new HideRequestApproval().groupHasInActiveMembers(current.u_approval_group)
Script:
// current.state = '10';
// action.setRedirectURL(current);
// current.approval = 'requested';
// current.update();
function checkgrp() {
var ajax = new GlideAjax('ValidateApprovalGroup');
ajax.addParam('sysparm_name', "getApprovalGroup");
ajax.addParam('sysparm_existingsys', g_form.getUniqueValue());
gs.addInfoMessage(gs.getMessage("Test Message123"));
ajax.getXML(getdata);
function getdata(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer.toString() == g_form.getValue("u_approval_group")) { //if both are same then only update else throwing the error
gsftSubmit(null, g_form.getFormElement(), 'request.approval');
gs.addInfoMessage(gs.getMessage("Test Message1234"));
} else {
alert("Before click on the 'Request Approval' button \nPlease Save the form");
}
}
}
if (typeof(window) == 'undefined')
updateAndRedirect();
function updateAndRedirect() {
current.state = '10';
action.setRedirectURL(current);
current.approval = 'requested';
current.update();
}
screen shot for UI Action - 'Request approval' button in change form
Script Include code:
var ValidateApprovalGroup = Class.create();
ValidateApprovalGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getApprovalGroup: function() {
var gr = new GlideRecord("change_request");
gr.addQuery("sys_id", this.getParameter("sysparm_existingsys"));
gr.query();
if (gr.next()) {
return gr.getValue("u_approval_group");
}
},
type: 'ValidateApprovalGroup'
});
Please help on this issue.
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2022 10:10 AM
Hi @Sravani47,
It seems you are modifying your UI action to check some conditions in on-click function for Normal change request.
I would recommended you to create a new UI action that will work for Normal change request and keep existing UI action for remaining change requests with type is normal.
Kindly hit Kudos and mark it correct based on your impact!
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 08:28 PM
Hi @Sravani47,
What should be the expected behavior, when user click Request approval button?
Is there any error or message appears?
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 09:52 PM
When the user clicks the 'Request approval' button, the state field should be set to 'Awaiting Authorisation,' the approval field should be set to 'Requested,' and the 'Request approval' button should be hidden.
No Error or message appears.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2022 11:08 AM
Hi Sagar,
created New 'Request Approval' Button for Normal type,
when click the 'request approval' button for Normal change, facing error message is
"Action not authorized"
Please assist me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 05:36 AM
Please assist me on this issue.