- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2020 09:18 PM
I am working in a scoped application on a catalog item. We are attempting to allow users to view information from a table on the form, in read only fields on the form. Some of the fields are lists (listing sys_ids from another table) on the table and list collectors (that references that other table) on the form. We populate the information via a client catalog script to setup a list collector field values on the right side.
Below is a sample of the type of scripting we are doing, with u_acct_targeted_apps being the list field on the table, and acct_targeted_apps being the list collector on the form. What's happening is weird. It's working like 1 in a million times, but always on the same record. We can't see why the one record works and others don't. The only thing I can think of is that a different list collector is actually functioning on those records (for a different field) and for some reason only one list collector is working at time. Any ideas on how we can do it better?
We need these fields to stay list collectors because we need to list out all the choices from the table with the proper referenced data, and allow for the option to update these fields depending on choices the user makes. It doesn't appear another field type would allow us this option.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
//query the account information from the master table
var acct = g_form.getReference('acct_name_lookup', popForm);
}
function popForm(acct) {
//Basic information fields
if (acct.name != '') {
g_form.setValue('acct_name', acct.name);
} else {
g_form.clearValue('acct_name');
}
if (acct.u_acct_targeted_apps != ''){
alert(acct.u_acct_targeted_apps);
g_form.clearValue('acct_targeted_apps');
g_form.setValue('acct_targeted_apps', acct.u_acct_targeted_apps);
} else {
g_form.clearValue('acct_targeted_apps');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2020 09:30 PM
Hi,
please refer below blog if it helps
Dynamically set list collector on change of variable
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2020 09:30 PM
Hi,
please refer below blog if it helps
Dynamically set list collector on change of variable
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 09:39 AM
Looks like we are going to have to adjust how we are doing things since we only have sys_id not display values for our scenario but this looks to be a potential solution thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 11:35 PM
Hi,
I am glad to hear the comment has helped.
Saying this, I will appreciate if you close this thread, as answered.
Have a great rest of the day.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader