Need to set Default value for an Advanced Qualifier reference variable

Rashim Walia
Tera Contributor

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)

RashimWalia_1-1671659570893.png

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!!

7 REPLIES 7

SanjivMeher
Kilo Patron
Kilo Patron

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.

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

}

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.

Thanks Sanjiv !! But I will need to write Script Include in order to use Glide Ajax?