Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

need help in script V1

nameisnani
Mega Sage

Hi Team , 

 

can anyone please help me with this issue 

 

In RITM form i have configured custom fields 

nameisnani_0-1733738925239.png

 

 

I have wirtten business rule and cilent script for this 

nameisnani_1-1733738926980.png

 

nameisnani_2-1733738926898.png

 

 

cilent script 

nameisnani_3-1733738926982.png

 

function onLoad() {
    //Type appropriate comment here, and begin script below

    var b = g_scratchpad.ritmvisble; //Value from BR -Checking if user is part of tech hub or Operations team- if logged user is member of either AVN-TechHub-SUP / CFS_ITOperations_OPS_APR or not.


    if (b) {


        // 		g_form.setDisplay('u_escalation', true);
        // 		g_form.setDisplay('u_escalation_comments', true);


        g_form.setReadOnly('u_escalation', false);
        g_form.setReadOnly('u_escalation_comments', false);
        g_form.setReadOnly('u_esc_by_ritm', false);
        g_form.setReadOnly('u_esc_date_time_ritm', false);
    } else {


        g_form.setReadOnly('u_escalation', false);
        g_form.setReadOnly('u_escalation_comments', false);
        g_form.setReadOnly('u_esc_by_ritm', false);
        g_form.setReadOnly('u_esc_date_time_ritm', false);
    }
}

 

That escalted field should only enable only for Tech hub team .

'while doing testing 'Gunjan ' is the tech hub team , i have impersonated with his profile 

nameisnani_4-1733738926987.png

 

I am getting this error 

nameisnani_5-1733738926986.png

 

 

And form saving fields should be gerdout

nameisnani_6-1733738926984.png

 

 

Can anyone please help me with this?

 

Please provide me the updated script.

2 REPLIES 2

Bhavya11
Kilo Patron
Kilo Patron

Hi @nameisnani ,

 

Normally this issue is seen when setting the reference field with a value which does not exist in the referring table and also check for 'current.setAbortAction(true)' in the business rules on the related tables.

 

 

Thanks,

BK

Mark Manders
Mega Patron

https://www.servicenow.com/community/developer-forum/need-help-in-script/td-p/3122602


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark