The CreatorCon Call for Content is officially open! Get started 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
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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader