Reference field value not visible in form and showing 'No preview available' when clicked on info icon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 10:04 PM
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.
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 11:41 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 11:47 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 11:53 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2021 12:17 AM
Hi,
I usually use this method to set the value i.e. setValue() which is faster
gr.setValue('assigned_to', 'sys_id')
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader