- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2022 02:55 AM
How to filter Service Offerings based on Services selected from Record Producer ( Service Portal)
Both Service and Service Offering variables are referencing to cmdb_ci_services tabel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 07:11 AM
Hi,
So it means the ref qualifier works with hard-coded value of service sysId
Since you want to filter records you need not use script include; this should ideally work
Is the variable name business_service correct?
javascript: 'parent=' + current.variables.business_service.toString();
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
‎01-15-2022 05:37 AM
Still not filtering.. displaying empty from service offerings list
Am I doing any wrong here? This is the Offerings table.
Note: I'm doing this work for a Record Producer.. is that because of that? or any cross scope application issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 05:56 AM
Nope it should not be. Can you make your Script Include accessible to All Scopes.
Also can you put a log and see if the Script Include is getting executed and what it is returning as shown below and let me know what values are you getting there:
I have modified the script Include as parameter name was missing in my initial script so use below
function getOfferings(service) {
gs.info('SI getting called' + service);
var arr = [];
var gr = new GlideRecord('offering Table Name Here');
gr.addQuery('parent field name', service);
gr.query();
while (gr.next()) {
arr.push(gr.sys_id.toString());
}
gs.info('Value returned is ' + arr);
return 'sys_idIN' + arr.toString();
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 06:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 07:50 AM
Can you show me your Script Include Screenshot which you have written. Also can you update it as below and check again:
Script Include:
Not a Client Callable Script Include, Name of Script Include is "getOffering"
var getOffering = Class.create();
getOffering.prototype = {
initialize: function() {},
getServiceoffering: function(service) {
var arr = [];
var gr = new GlideRecord('offering Table Name Here');
gr.addQuery('parent field name', service);
gr.query();
while (gr.next()) {
arr.push(gr.sys_id.toString());
}
gs.info('Value returned is ' + arr);
return 'sys_idIN' + arr.toString();
},
type: 'getOffering'
};
Reference Qualifier to be updated as below:
javascript:'sys_idIN' + new getOfferings().getServiceoffering(current.variables.VariablName);// Replace Variable Name with your Service Variable
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 06:18 AM
ideally no need of script include
try for some hard-coded values and check if it shows only those records
javascript: 'parent=' + 'businessServiceSysId';
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader