- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 06:18 PM
Hi everyone!
I need a help on this requirement. We are customizing the Private Task form [vtb_task] and we have created two new fields "Technical Service" and "Technical Service Offering".
- "Technical Service" is a reference field , referencing "Technical Service" table
- "Technical Service Offering" is a reference field , referencing "Service Offering" table
The first requirement is when a "Technical Service" is first selected, the "Technical Service Offering" list will be filtered based on the "Parent" field which is the selected "Technical Service"
The second requirement is when a "Technical Service Offering" is first selected, the "Technical Service" is Auto Populated based on "Parent" ("Technical Service") field of the selected "Technical Service Offering"
I am having a hard time finding the solution for this even though I have created several scripts. I've created a Script Include, Client Scripts and also added reference qualifiers, but NO Luck.
Would appreciate if you can help me on this. Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 07:58 PM
Hi @ss123,
Try this updated scripts for auto populates -
Client Script: BM - Autopopulate Technical Service
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var sc = g_form.getValue('x_bmk_technology_s_u_service_offering');
var ga = new GlideAjax('x_bmk_technology_s.technicalServiceOffering');
ga.addParam('sysparm_name', 'getServDetails');
ga.addParam('sysparm_servId', g_form.getValue('x_bmk_technology_s_u_service_offering'));
ga.getXMLAnswer(getResponse);
function getResponse(response) {
var res = JSON.parse(response);
g_form.setValue('x_bmk_technology_s_u_technical_service_private_task', res.x_bmk_technology_s_u_technical_service_private_task);
}
}
Script Includes
Name: technicalServiceOffering
Client callable - true
var technicalServiceOffering = Class.create();
technicalServiceOffering.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getServDetails: function() {
//gs.addInfoMessage('script include triggered');
var servId = this.getParameter('sysparm_servId');
//gs.addInfoMessage('service scr--' + servId);
obj = {};
var gServOffering = new GlideRecord('service_offering');
if (gServOffering.get(servId)) {
obj.x_bmk_technology_s_u_technical_service_private_task = gServOffering.getValue('parent');
}
//gs.addInfoMessage(obj+JSON.stringify(obj));
return JSON.stringify(obj);
},
type: 'technicalServiceOffering'
});
Reference qualifier -
javascript:"parent="+current. x_bmk_technology_s_u_service_offering;
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 04:04 PM
Hi Sagar,
Hope's all good.
I have a similar requirement please see this post link below, can you provide me the sohttps://www.servicenow.com/community/csm-forum/need-to-filter-the-service-offering-choices-based-on-the/m-p/... for this.
Thanks in advance.
Regards,
Abhilasha G T
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 01:50 AM
Hi @Sagar Pagar ,
Hope's all good,
I have the similar requirement, will you provide the solution for that.
Please see the below post for my requirement. Will you provide me the solution, Service Offering choices are filtered to match the location on incident location which includes the name , state, city ,parent and country of the location.
Thanks in advance,
Regards,
Abhilasha G T