How to disable Approve/Reject in List choice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2016 05:59 AM
Hi,
In change Request there is a Approver Related list,
When one of the approver approves the request, then In the drop down, it should disable the Approve/Reject choices
How this can be done?
1)
2)
Thanks,
Priyanka
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 10:19 PM
Abhinay Thanks for the response,
Can you please share the code which is working for you for form button, I will try from my side and try my luck.
Thanks,
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 10:27 PM
Try modifying for the UI Action where List action is set to true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 11:16 PM
Hi Padmini ,
Thanks for the response,
When I tried like that, In the list choice drop down, Its showing as Approve(4 of 5).
The requirement is one of the record is approved, it should get totally disable even other approval records are in other states(requeste,no loner required etc) to that specific change request.
Thanks,
Priyanka

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2016 08:02 AM
Hi priyanka,
Sorry I was not awake to reply you back. Here is a solution, this will still show the approve button in the list choice but, if the approvals are already approved, even when you click this UI action, it does not update anything. I think this should be helpful. Here is the UI action script and script include for that.
UI action Script:
function getCheckedApprovals(){
var id=g_list.getChecked().split(',');
var ga = new GlideAjax('CheckApprovals');
ga.addParam('sysparm_name','validateApproval');
ga.addParam('sysparm_ids',id.join());
ga.getXML(callBack);
function callBack(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer=="true"){
g_form.save();
}
else{
return false;
}
}
}
Script Include:
var CheckApprovals = Class.create();
CheckApprovals.prototype = Object.extendsObject(AbstractAjaxProcessor, {
validateApproval: function(){
var gr= new GlideRecord("sysapproval_approver");
gr.addQuery('sys_id','IN',this.getParameter('sysparm_ids'));
gr.query();
if(gr.next()){
var gr1= new GlideRecord("sysapproval_approver");
gr1.addQuery('sysapproval',gr.getValue('sysapproval'));
gr1.addQuery('state','approved');
gr1.query();
if(!gr1.hasNext()){
var gr2= new GlideRecord("sysapproval_approver");
gr2.addQuery('sys_id','IN',this.getParameter('sysparm_ids'));
gr2.query();
while(gr2.next()){
gr2.state='approved';
gr2.update();
}
return true;
}
return false;
}
return false;
},
type: 'CheckApprovals'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2016 07:41 AM
Let me know if this helped??