I want to show the new button for Issue in Control related list for Control owner or owing grp membe

anandwakode
Tera Contributor

I want to show the NEW button for Issue in Control related list for Control owner or owing grp member. If user other than Control owner or member of owning group login that user should not see the new button. In both Workspace and Classic UI

1 REPLY 1

pr8172510
Mega Guru

Hi @anandwakode

You need to control this via UI Action condition + ACL (for backend safety).


1. Classic UI (Related List “New” button)

Update the UI Action (New) on the Issue table and add condition like:

var control = current.control; // adjust field name if different
if (!control)
answer = false;

var ctrlGr = new GlideRecord('sn_grc_control');
if (ctrlGr.get(control)) {
answer = (gs.getUserID() == ctrlGr.owner) ||
gs.getUser().isMemberOf(ctrlGr.owning_group);
}

2. Workspace (important)

Workspace ignores UI Action conditions, so:

  • Create Action Assignment / Declarative Action condition
  • Add same logic in condition script

3. Backend enforcement (recommended)

Add ACL on Issue table (create):

var control = current.control;
if (!control)
answer = false;

var ctrlGr = new GlideRecord('sn_grc_control');
if (ctrlGr.get(control)) {
answer = (gs.getUserID() == ctrlGr.owner) ||
gs.getUser().isMemberOf(ctrlGr.owning_group);
}