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
Not applicable

For this request, I am changing the value of the field to true. The scenario is:

If caller is 'External User', set the 'u_external_user' field to true.

Hi @Community Alums ,

 

Ok, then you need a OnChange client script to set value to true.

 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Community Alums
Not applicable

I am using an onChange Client Script but it is not toggling the field. Here is the code:

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    if (g_form.getDisplayBox('<opened for>').value) == 'External User';
   {
        g_form.setValue('u_external_user', true); //when caller is external user
    }
    else {
        g_form.setValue('u_external_user', false); //when caller is NOT external user
    }
}

Community Alums
Not applicable

The 'u_external_user' field value is not changing.

Can you Share screenshot of the form filler that shows you have selected external user.

And your script.

-Anurag