
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 09:46 PM
For a catalog item I'm creating I need to populate a reference field if checkbox is checked, with the current user.
Checkbox variable field:
checkbox_1
Reference field on sys_user table:
name_field
If checkbox_1 = true then name_field = current users name
I figure this would require a Catalog Client Script?
Not sure how to write it - if anyone is able to assist please?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 10:23 PM
Ok thank you @Anirudh Pathak I've tried it and hasn't worked unfortunately
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var check = g_form.getValue('checkbox_1');
if (check == true) {
g_form.setValue('name_field', g_user.userID);
} else {
g_form.clearValue('name_field');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 10:02 PM - edited 05-07-2024 10:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 10:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 10:20 PM
Hi @Bidduam ,
You can create an "onchange" client script on checkbox_1 variable -
if (newValue == 'true') {
g_form.setValue('name_field', g_user.userID);
} else {
g_form.clearValue('name_field');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 10:23 PM
Ok thank you @Anirudh Pathak I've tried it and hasn't worked unfortunately
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var check = g_form.getValue('checkbox_1');
if (check == true) {
g_form.setValue('name_field', g_user.userID);
} else {
g_form.clearValue('name_field');
}
}