Set field value true if the caller field has a particular person

Community Alums
Not applicable

On an interaction, I have a field name 'u_external_user'. It is a checkbox (True/False).

I want to toggle this field True if the Opened for field 'opened_for' is a user named External User. I believe a client script will be the best way to do this but need advice on this and code if anyone can help.

1 ACCEPTED SOLUTION

Shamma Negi
Kilo Sage
Kilo Sage

if(g_form.getValue("opened_for") == "sys id of the external user)

{

g_form.setValue("<external_user_checkbox" , true);

}

else

 

{

g_form.setValue("<external_user_checkbox" , false);

}

Regards,Shamma Negi

View solution in original post

23 REPLIES 23

@Community Alums you can check this above code.

Dibyaratnam
Tera Sage
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ref = g_form.getDisplayBox('<opened for>').value; 
if(ref=='External User'){
g_form.setValue('u_external_user', true);
}
else g_form.setValue('u_external_user', false);
    }

                
    }
}

@Community Alums check this out if it helps

 

Community Alums
Not applicable

I tried this one also. It will not set the field value to true. I did update the field name to opened_for.

Community Alums
Not applicable

Can you help with this code for the incident form?

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Community Alums 

 

It can be done via UI Policy.

 

LearnNGrowAtul_0-1702546061255.png

 

 

I created it for Incident table, 

 

You can any of condition, 

if external user flag is true or external user name is :

 

Do the UI action

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************