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 10:16 PM
Hi,
assignment_group field is reference so it would require sys_id if you are setting it directly
do either of this
1) d.setDisplayValue('assignment_group','cross platform');
OR
2) d.assignment_group='group sysId';
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:03 PM
Thanks Ankur. This code works well.
Do you have any idea, how assigned to(reference) field got updated using 'assigned_to='XXXX' script ? Why I didnt face above issue to 'assigned to' filed ? Is there any difference between assigned to and assignment group fields ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 11:15 PM
Hi,
for assigned_to = 'sysId' should work
it will set value in assigned_to when you use assigned_to = 'abel tuter' but it won't show the user record populated as it is not the correct way
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:32 PM
Hi Ankur,
yeah I agree, it is better to update reference field using sys id. But If I update using name/user id it worked fine, I can see exact user record if i click on info icon.
So, How this method works fine only for assigned_to field and not to group ? what may be the difference ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2021 11:37 PM
Hi,
if you are setting the display value for the reference field then it would work
please share what worked for assigned to
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader