- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 04:16 AM
Hello, I have a variable (type reference) which is called territory. Based on the selection of a given territory, another field (CISO group) should be autopopulated. I was working on the client script below but it hasn't worked so far. Any clues? suggestions?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var territory = g_form.getReference('territory', callback);
function callback(territory) { //reference is passed into callback as first arguments
g_form.setValue('ciso_group',territory.sys_user_group);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 04:42 AM
g_form.setValue('ciso_group',territory.u_ciso_group);
Did this not work? What type of variable is ciso_group? is it a reference variable or single line test?
also try to do alert(territory.u_ciso_group); in your function to check what are you getting.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 04:25 AM
Tour code seems correct. can you confirm below:
var territory = g_form.getReference('territory', callback); // which table does your territory field refers to?
function callback(territory) { //reference is passed into callback as first arguments
g_form.setValue('ciso_group',territory.sys_user_group); // is sys_user_group a field on the table to which territory refers to?
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 04:36 AM
RaghavSh, thanks for your quick reply.
territory is a reference type variable and it refers to the [core_company] table.
I don't know if sys_user_group is a field on the table to which territory refers to. I'll check. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 04:38 AM
yes you can only dot walk the fields on core_company table like territory.name , will give you company's name selected in territory.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2022 04:39 AM
Just checked. I tried with the name of the field (u_ciso_group) and with reference (sys_user_group) as a second attempt. Neither worked.