Issue with populating Assigned To field on Incident form

Suggy
Giga Sage

Need to set Assigned To field in Incident form via REST API/Business rule.

 

If I use below script,

rec.assigned_to = 'Andrew Och'; // THIS WORKS

 

but if I use below script,

rec.setValue('assigned_to', 'Andrew Och');// DOES NOT work. Why?

 

Infact everyone says use sys_id for reference fields. Then why 1st script worked? Why 2nd script failed?

 

PS - For User table, Diplay is set to FALSE for ALL the fields. 

Also in Assigned To dictionary attribute, its all EMPTY.

 

 

11 REPLIES 11

Suggy
Giga Sage

Anyone?

maroon_byte
Mega Sage
Below will work instead of setValue because you want to set the display value not the value (which is the sys_id):
rec.setDisplayValue('assigned_to', 'Andrew Och');