Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to add dynamic Encoded query in below script

keval3
Tera Contributor

Hi All,

please help me with below requirement

I am create fix script and I want to add dynamic query in the encoded query please let me how how to add I have written the script below.

var serNum = 1;
var ab = new GlideRecord('x_upl2_mx_digitize_experiment');
ab.orderBy('number');
ab.query();
if (ab.next()) {
var xy = new GlideRecord('x_upl2_mx_digitize_sample_and_analysis');
xy.addEncodedQuery('experiment_number='++ ab)

 

Thanks & Regards

KP

1 REPLY 1

Ankur Bawiskar
Tera Patron

@keval3 

experiment_number is reference field?

If yes then try this

xy.addEncodedQuery('experiment_number='+ab.getUniqueValue());

If my response helped please mark it correct and close the thread so that it benefits future readers.

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