Populate the service offering values depends upon the parent of service offering on other variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2023 05:28 AM
Hi
In my catalog item i have two variables with the name's Service with reference type to Service_offering table and other one bussiness with type select box with question choice. Here when we select question choice in bussiness then I want to display the service offering values in service variable.
For example:- if I select X in bussiness variable, the relation ship with service offering table is X is the parent for some of the Service offering that should be display in service variable
Here If I select slack in business variable i want to display tes2 in service variable
can you pls help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2023 07:57 AM
Hi @shaik mahaboobj ,
Update your Client Script like below.
var business=newValue;
var ga=new GlideAjax('scriptIncludeName');
ga.addParam('sysparm_name','getService');
ga.addParam('sysparm_business',business);
ga.getXML(getResponse);
function getResponse(response)
{
var answer=response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('service_variable_name', answer);
}
and Script Include like below.
getService: function()
{
var serviceName='';
var businessName=this.getParameter('sysparm_business');
var grOffering=new GlideRecord('service_offering');
grOffering.addQuery('parent.name',businessName);
grOffering.query();
if(grOffering.next())
{
serviceName=grOffering.getValue('sys_id');
return serviceName;
}
}
If my answer helps to resolve your issue then please mark it as correct and helpful.
Regards,
Devender