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

Ankur Bawiskar
Tera Patron
Tera Patron

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

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

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 ?

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

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

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 ?

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

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