The CreatorCon Call for Content is officially open! Get started here.

Reference field value not visible in form and showing 'No preview available' when clicked on info icon

Preethiga1
Tera Contributor

Hi,

Assignment group field is updated in background script (PFB) , but value is not displaying in form as well as in list view. But if I tried to update assigned to field using similar script(d.assigned_to='XXXX') it works fine. I can use setDisplayValue() in below script to make it work for group, but I just need to know why assigned to filed got updated correctly and not group field? what is the difference between these fields referencing to user/group table? Note: Even I checked both dictionary override fields, there is no much difference. Also, no field in user/group table is marked as display true and value we are trying to update in group field is available in instance.

find_real_file.png

find_real_file.png

Background Script Used:

var d= new GlideRecord('incident');
d.addEncodedQuery('numberSTARTSWITHXXXXXXXXXX');
d.query();
gs.print(d.getRowCount());
if(d.next()){
d.assignment_group='cross platform';
d.update();
}

18 REPLIES 18

Hi Ankur,

I tried in below 2 ways to update assigned to field (gr.assigned_to='XXXX') and it worked, 

--> XXXX as 'userID of user record'

--> XXXX as 'name of user record'

Note: I didn't use XXXX as sys_id. Also, no fields in user table has display as true.

Hi,

that's correct.

OOB no display=true and it considers the name column as display

Now reason being userId might have worked is because that is unique in the table

But I would recommend to set sys_id by querying the user table and use that

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks a lot Ankur for your response. Appreciate it!

By any chance if you get more info on 'How user referencing fields getting updated in this way' Kindly share it here.

Hi,

I usually use this method to set the value i.e. setValue() which is faster

gr.setValue('assigned_to', 'sys_id')

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader