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.

Reference field being set by business rule is getting sys_id but it's not displaying correctly

e_wilber
Tera Guru

I have no idea what's going on.

 

This field is being set in a business rule (you can see there's a sys_id attached to it but it's empty):

e_wilber_0-1691158225474.png

The field data looks like: 

e_wilber_1-1691158263608.png

 

//patient is the sys_id as a string

var wot = new GlideRecord('wm_task');
wot.initialize();
wot.parent = ev.u_work_order;

wot.u_patient = patient;

wot.insert();

 

Why isn't this field being set correctly?

5 REPLIES 5

Riya Verma
Kilo Sage

Hi @e_wilber ,

 

Hope you are doing well.

 

Try using below script for setting the reference field value:

 

var wot = new GlideRecord('wm_task');
wot.initialize();
wot.parent = ev.u_work_order;
wot.setValue('u_patient', ' <sys id o patient which your want to set>' ) 
wot.insert();

 

 

And also make sure to check the referencing table has exactly once column with display ="true".

 

 

 

 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma