How to visible the UI action based on the condition to the logged in user
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 09:08 AM
Hey Experts,
I wanted to show the UI action based on the condition as follows:
UI Action is visible only when the logged-in user is an admin, and has more than 5 incident records where he/she is a caller.
Please help me with this
Thanks, atik
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 10:20 AM
Hi @Atik ,
You can call a script include in the condition in a UI action
Condition field script: new UiactionUtils().checkStandard(); (Your script include name and function )
Script include: Add the below script
var UiactionUtils = Class.create();
UiactionUtils.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
checkStandard: function() {
var gr=new GlideRecord("incident");
gr.addEncodedQuery("caller_id="+gs.getUserID());
gr.query();
var gk=gr.getRowCount();
if(gs.hasRole("admin")&&parseInt(gk)>=5){
return true;
}
else{
return false;
}
},
type: 'UiactionUtils'
});
Try this solution and accept this if it works
Regards
Vengadesh