How to filter Service Offerings based on Services selected from Record Producer ( Service Portal)

Vijayr119
Tera Contributor

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

find_real_file.pngfind_real_file.png

1 ACCEPTED SOLUTION

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

18 REPLIES 18

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Is there any query business rule on cmdb_ci_service table which is restricting?

any table level READ ACL?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

If there is issue with read ACL then Service field value shouldn't display the value from portal.. here I can see the list of Services from portal but not filtering the service offerings based on services selected. 

 

 

can you try to hard-code the advanced ref qualifier to check if the filtering works?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

How can I do that? any guide to follow? or any sample code?

Have you tried using a combination of Client script and Script Include for your scenario:

1) Create a Client Callable Script Include and use the below script:

Make sure the Script Include and Function Name is same.

function getOfferings() {
    var arr = [];
    var getServiceSeelcted = this.getParameter('sysparm_service');
    var gr = new GlideRecord('offering Table Name Here');
    gr.addQuery('parent field name', getServiceSeelcted);
    gr.query();
    while (gr.next()) {
        arr.push(gr.sys_id.toString());
    }
    return 'sys_idIN' + arr.toString();
}

find_real_file.png

Now update your Reference Qualifier in Service offering Variable as below:

javascript:'sys_idIN' + getOfferings(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

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke