How to hide the New button in the Teams related list for non-admin users on Service/Service Offering

muskanattar
Tera Contributor

Hello Community,

 

On the Service and Service Offering records, there is an OOTB related list called Teams.

 

In this Teams related list, the New (and Edit) buttons behave as follows:


• For admin users, the New and Edit buttons are visible and records can be created/edited as expected
• For non-admin users, clicking the New button opens the record in read-only mode

 

Our requirement is to hide the New (and Edit) buttons completely from the form UI for non-admin users on the Service and Service Offering tables, instead of showing the button and opening a read-only form.

 

What we have tried:
• Implemented Omit Rules on the related list, but the New button is still visible
• Checked form-level configurations, but could not suppress the button

 

Requirement:
• Hide the New buttons in the Teams related list for non-admin users
• Apply this only on Service and Service Offering forms

 

Could you please advise:
• Whether this behavior is controlled via ACLs, UI Actions, Related List properties, or OOTB CSDM logic
• The recommended technical approach to hide these buttons at the form / related list level.

 

Any technical guidance or best practices would be appreciated.

 

Thank you.

10 REPLIES 10

Tejas Adhalrao
Tera Guru

Hi @muskanattar  ,

 just use this  script 

!gs.hasRole('admin')

muskanattar
Tera Contributor

Hi @Tejas Adhalrao ,

 

I checked with below script but still same behavior.

 

var answer = true;

if (!gs.hasRole('admin')){
    answer = false;
}

You need to declare it as  if(!gs.getUser().hasRole('admin')) .

Thanks

nayanmule
Kilo Sage

Hi @muskanattar ,

 

I think the way you have declared in the line number 2 seems incorrect.
You can just user var user = gs.getUserId(); this would be sufficient to get the current logged in user details.

 

Thanks,

Nayan

 

If my response has helped you ,kindly mark it as helpful and accept the solution.