Facing an issue while customising an OOB script for Product Offering Eligibility in ServiceNow

ankitbanerj
Tera Expert

We're currently modifying the out-of-the-box script include to return an encoded query based on a combination of two fields. While the script works correctly when returning a single field condition, it fails when we append multiple conditions using the ^ operator.

This seems to break the query formation unexpectedly — has anyone encountered this issue before or found a workaround to ensure the combined conditions are evaluated properly?

Any insights would be greatly appreciated. Thanks in advance!

4 REPLIES 4

Its_Azar
Tera Guru

Hi @ankitbanerj 

 

usually when the ^ operator isn’t properly escaped or the syntax isn’t clean.

If you're building the encoded query dynamically in your Script Include, make sure you're not adding spaces around the ^, and also wrap conditions in parentheses if needed. Here's a quick example:

If you're concatenating, try:

var query = 'field1=' + val1 + '^field2=' + val2;

Also, check if any of the field values have special characters that need escaping. please drop the script lets see if anything is missing in script itself.

 

If this helps kindly accept the solution thanks much.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India

Hi @Its_Azar ,
thanks for your reply!
I have checked that we are building proper query with the '^' operator, still it is not working. We did raise on HI ticket they also don't have a solution for now.

RanjaniR
ServiceNow Employee
ServiceNow Employee

@ankitbanerj  Are you trying to setup eligibility rules to filter the products in the catalog that the Sales Agent can see?

Hi @RanjaniR correct, I am trying to setup eligibility rules to filter the products in the catalog that the Sales Agent can see?