UI Action Visibility

Arjun Kumar Le1
Tera Contributor

Close button in change request form need to visible to the member of the group Approval related list , what condition I need to add in button  can you please help me in this?

ArjunKumarLe1_0-1677011884536.png

 

5 REPLIES 5

AshishKM
Kilo Patron
Kilo Patron

Hi,

Apply the UI Action's condition, check the current logged in user is member of specific group or not. You can use AND / OR operator if groups are more than one.

 

gs.getUser().isMemberOf('IT-Infrastructure-Management')

AshishKMishra_0-1677016416915.png

 

 

Please mark helpful and correct answer if it helps you.

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Basheer
Mega Sage

Hi @Arjun Kumar Le1 ,

Because close button is an OOB button, don't try to edit anything on the same.

Create a new button on change request form with the same name and action_name it will hide the oob button and make the custom one visible.

Then coming to the condition which you need to mention.

As it is not straightforward requirement, you need to call a script include from condition field. In that script include you need to glide to group approval table and query it based on the change request and fetch the details.

 

Let me know if you need any help in scripting the solution mentioned above.

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Thanks Basheer, 

I need help in the Script , Can you please provide me script

I have written the below script include, please let me know what condition i need to add in the UI Action to call the script include.

var MyScriptInclude = Class.create();
MyScriptInclude.prototype = {
initialize: function() {},

isApprovalGroupMember: function() {
// Check if the current user is a member of the Approval group
var approvalGroup = GlideRecord('sys_user_group');
approvalGroup.addQuery('name', 'Approval');
approvalGroup.query();
if (approvalGroup.next()) {
var members = GlideRecord('sys_user_grmember');
members.addQuery('group', approvalGroup.sys_id);
members.addQuery('user', gs.getUserID());
members.query();
if (members.next()) {
return true;
}
}
return false;
}
};