- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 07:42 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2023 05:12 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 08:24 AM
Hi Shannon,
A client script would do but how do you identify an external user?
If you have any field on the user table that will tell you that the user is external then you can use this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ref = g_form.getReference('<opened for>', getUserRec); //assuming caller is opened_for
}
function getUserRec(ref) {
g_form.setValue('u_external_user', ref.<field on user that showes he is external user>);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 08:27 AM
We have created a user account called External User. When selected, I want to toggle this checkbox true because it makes visible fields to store the external user's information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 08:38 AM
Hi,
So if I understand, if you select 'External User' as called on interaction then you want to toggle a checkbox
if I understood correct then you can do something like this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(g_form.getDisplayBox('<opened for>').value) == 'External User' //assuming caller is opened_for
{
g_form.setValue('<field to toggle>', <value>); //when caller is external user
}
else{
g_form.setValue('<field to toggle>', <value>); //when caller is NOT external user
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2023 11:45 PM
Hi @Community Alums ,
Why not create a UI Policy? If caller is External user, then show XXXX fields. This is OOTB configuration and no scripting is needed.
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/