Limit / Restrict Record Producer In Close Complete and Close Incomplete state

JVINAY
Tera Contributor

 

Hi all,

I have a requirement in Service Portal related to a custom application (Cloud Intake Request).

On the record page of the table u_cloud_intake_request, there is an “I want to…” side panel that displays several action links. One of these options is:

➡️ “Request to Change CIR Requestor”
(This opens a Record Producer.)

Requirement

I need to hide this specific option only when the CIR record is in the following states:

  • Close Complete → internal value = 3
  • Close Incomplete → internal value = 8

In all other states (Approval, Prod, Env Pro, Work Env), the option should remain visible.



I have written this Code This Code Works but the Option shows in all states .

 

JVINAY_0-1771338052805.png

Code :

canChangeRequestor: function(cir_id) {
        var gr = new GlideRecord("u_cloud_intake_request");
        if (gr.get(cir_id)) {


            var st = String(gr.getValue('state') || '');
            if (st === '8' || st === '3') {
                return false;
            }

            if (gr.state == "110") {

                if (gs.hasRole('u_cloud_intake_admin')) return true;
                if (gs.hasRole('u_cloud_intake_analyst')) return true;
                if (gr.sys_created_by == gs.getUserName()) return true;
                if (gs.getUserID() == gr.getValue('opened_by')) return true;
                if (gr.getValue('watch_list') && gr.getValue('watch_list').indexOf(gs.getUserID()) > -1) return true;
            } else {
                return false;
            }
        }
        return false;
    },
 
Please help me ..
0 REPLIES 0