Column in Multi row variable set returning null despite the related field not being selected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 04:39 AM
I'm trying to develop a catalogue item uses multi row variable sets. Most of the columns on the catalogue item are populating correctly as required. However, I'm having an issue with one of the columns:
What I've noticed is that if select my option for a New Platform, the 'New Lab Level/Platform Child' column is immediately set to null, even though the option for my new Lab has not been selected. When trying to select a new Lab, the available options don't load.
My Script Include is:
The below client script is an on change client script for the selected Business Applications:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 06:10 AM
what debugging have you done so far?
you need to check if value is present or not
existing_app_srvc: function() {
var aps_value = [];
var ci_sysid = this.getParameter('sysparam_ci_sysid');
var ci_new_platform = this.getParameter('sysparm_platform');
var ci_new_lab = this.getParameter('sysparm_lab');
var grapp = new GlideRecord('cmdb_ci_business_app');
grapp.addQuery('sys_id', 'IN', ci_sysid);
grapp.query();
while (grapp.next()) {
var row = {
'business_application_number_variable_set': grapp.number.toString(),
'business_application_owner_variable_set': grapp.u_business_owner.getDisplayValue(),
'business_application_name_variable_set': grapp.name.toString(),
'current_business_owning_platform_variable_set': grapp.u_business_owning_division.getDisplayValue(),
'new_platform_variable_set': ci_new_platform
};
if(ci_new_lab) // check here if it's there and remove it from above
row['new_lab_level_platform_child_variable_set'] = ci_new_lab;
aps_value.push(row);
}
return JSON.stringify(aps_value);
},
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 06:48 AM
Thanks @Ankur Bawiskar I've tried that and now the following weird behaviour is happening:
When I select a Lab after selecting my New Platform, the Platform field is set to Null
When I select a New Platform, the Platform field is set to Null:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 07:39 AM
handle the same logic for that variable
Check if value is present or not and if yes then only set the value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 08:53 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader