Refernce filed populating sys id on the record

Community Alums
Not applicable

Hi All, 

 

grIncident.setValue('u_actual_name', producer.manufacturer + producer.name);

 

chanti1_0-1690519621266.png

 

 

on record producer script we are trying to set the value to the field value.  but its populating the sys id. 

 

we are combining two value manufacturer (reference) and name is string field. 

 

need suggestions to achieve this. 

4 REPLIES 4

Samaksh Wani
Giga Sage
Giga Sage

Hello @Community Alums 

 

use this :-

 

grIncident.setValue('u_actual_name', producer.manufacturer.name + " "  + producer.name);

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

Sagar Pagar
Tera Patron

Hi @Community Alums,

 

If you have the correct manufacturer records sys_id, then no need to combine with name.

 

Try this and let me know. It should display the manufacturer name in that field.

grIncident.setValue('u_actual_name', producer.manufacturer);

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

Hi @Community Alums,

 

Have you look into it? Let me know if you stuck and need any help.

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

Harish KM
Kilo Patron
Kilo Patron

hello I believe Entered Model Name field is a string field not reference type so you need to change the code below

grIncident.setValue('u_actual_name', producer.manufacturer + producer.name);

 

to

grIncident.setValue('u_actual_name', producer.manufacturer.name + producer.name); //use producer.manufacturer.name or producer.manufacturer.getDisplayValue()

Regards
Harish