- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2024 11:16 AM
Hello,
Any assistance is appreciated.
I have a cat item which has the following
1. Reference Variable pointing to cmdb_ci_business_app table. 2. Once I make a selection from 1 then a lookup selectbox filters values from cmdb_rel_ci see below.
3. There is a reference variable to the user table which they would populate with the child.owned_by when 2 is selected. I tried below but it is not working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2024 05:55 PM
Here is the corrected Script Include, with some temporary log lines, so if you are still not getting the expected results you can share which system logs you are seeing (filter on Message starts with SI)
var Cloud_Owned_by = Class.create();
Cloud_Owned_by.prototype = Object.extendsObject(AbstractAjaxProcessor, {
updateOwned: function () {
var results = 'none';
var buildingid = this.getParameter('sysparm_application_service');
gs.info('SI running: buildingid = ' + buildingid);
var loc = new GlideRecord('cmdb_ci');
loc.addQuery('sys_id', buildingid);
loc.query();
if (loc.next()) {
gs.info('SI record found: ' + loc.name);
results = {
"owned_by": loc.getValue('owned_by'),
"managed_by": loc.getValue('managed_by')
};
gs.info('SI results: ' + JSON.stringify(results));
return JSON.stringify(results);
} else {
return results;
}
},
type: 'Cloud_Owned_by'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2024 05:55 PM
Here is the corrected Script Include, with some temporary log lines, so if you are still not getting the expected results you can share which system logs you are seeing (filter on Message starts with SI)
var Cloud_Owned_by = Class.create();
Cloud_Owned_by.prototype = Object.extendsObject(AbstractAjaxProcessor, {
updateOwned: function () {
var results = 'none';
var buildingid = this.getParameter('sysparm_application_service');
gs.info('SI running: buildingid = ' + buildingid);
var loc = new GlideRecord('cmdb_ci');
loc.addQuery('sys_id', buildingid);
loc.query();
if (loc.next()) {
gs.info('SI record found: ' + loc.name);
results = {
"owned_by": loc.getValue('owned_by'),
"managed_by": loc.getValue('managed_by')
};
gs.info('SI results: ' + JSON.stringify(results));
return JSON.stringify(results);
} else {
return results;
}
},
type: 'Cloud_Owned_by'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2024 01:42 AM
javascript: 'fieldname of the app in the parent table=' + current.variables.select_your_application_service_environment.owned_by + '^active=true^internal_integration_user=false';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2024 06:11 AM
Thanks Brad for the assistance. I appreciate it.
Chad