showing particular record in reference list

Amit Dey1
Tera Contributor

Hi , I have created a reference type variable ,which is showing data from a table 

but I want to show a particular record in the first row in that reference list , can we do this ?

4 REPLIES 4

Rajesh_Singh
Kilo Sage
Kilo Sage

@Amit Dey1 

 

Yes, you can achieve this in ServiceNow with some scripting. You can create a dynamic filter option for your reference field to manipulate the order of the records.

You'd have to create a scripted filter that changes the order of the records based on your criteria

If you found my response helpful or applicable, please consider marking it as correct or helpful to assist others who may be seeking the same information.

---------------
Regards,
Rajesh Singh

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Amit Dey1 ,
I trust you are doing great.

 

Yes, it is possible to display a specific record as the first row in a reference list variable in ServiceNow. To achieve this, you can use a GlideRecord query to retrieve the desired record and then manipulate the reference list variable's display value.

Here's an example code snippet that demonstrates how you can accomplish this:

 

// Assuming your reference variable is called 'my_reference'
var myReference = current.my_reference;

// Querying the table to retrieve the desired record (replace 'table_name' and 'sys_id' with your actual table and record values)
var gr = new GlideRecord('table_name');
gr.get('sys_id', 'desired_record_sys_id');

// Reassigning the display value of the reference variable with the desired record
myReference = gr;

// Now, you can use 'myReference' in your script or UI policy to display the desired record as the first row in the reference list.

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



hi ,

how to use it in client script

Chaithu3
Tera Contributor

Hello experts,

we have a same requirement, the value called as ā€œNo result Foundā€ should be always show at the end of the result values in the reference field.

please help me asap

looping @Ankur Bawiskar  The ServiceNow Career Time-Machine - Chuck Tomasi