Need to set Default value for an Advanced Qualifier reference variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 01:55 PM
Hi,
I need to fetch Service Offerings subscribed by the User's company from the table service_subscribe_company. I have used the Adavanced Qualifier to fetch the values and its working fine (Below screenshot for reference)
My requirement is to set the default value if only one Service Offering is subscribed by the company.
I have tried to achieve this by Catalog Client script or the Default value in the Reference field but neither of them is working. Can anybody help me to achieve this functionality please?
Your help will be greatly appreciated , Thanks!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 01:59 PM
You can definitely use catalog client script to achieve this. Could you please share the catalog client script you used?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 02:10 PM
Below is the script I am trying to use:
function onLoad() {
var ServOff=new GlideAggregate('service_subscribe_company');
ServOff.addQuery('service_offering','8e21dc571be79dd02c496287bc4bcb5a');
ServOff.addQuery('service_offering','b951767edb6be34047f758b8dc9619de');
ServOff.addQuery('core_company',g_form.get('requested_for.company'));
ServOff.addAggregate("COUNT");
ServOff.query();
if(ServOff.next())
{
if(ServOff.getAggregate("COUNT")=="1")
alert(ServOff.service_offering); //return into CS
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 02:21 PM
I dont think you can use GlideAggregate in client script.
You need to use a GlideAjax. I have used gliderecord to get it tested if the logic works. But you should use glideajax.
var scount = 0;
var ServOff=new GlideRecord('service_subscribe_company');
ServOff.addQuery('service_offering','8e21dc571be79dd02c496287bc4bcb5a');
ServOff.addQuery('service_offering','b951767edb6be34047f758b8dc9619de');
ServOff.addQuery('core_company',g_form.get('requested_for.company'));
ServOff.query();
while(ServOff.next())
{
scount++;
}
if (scount==1)
{
alert(ServOff.service_offering); //return into CS
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 02:25 PM
Thanks Sanjiv !! But I will need to write Script Include in order to use Glide Ajax?