We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Doucment_ID is not displaying value

dev_K
Tera Contributor

Hi,

 

 

I want to update the 'Applies to record' field so it corresponds the Department.

 
 

As you can see the Department has a name but Applies To Records = empty.

 
 

 

 

ph1.jpg

 

 

When looking at XML, however  these 2 fields have same sysID, so they should point to that specific Department Name.

 

 

Im using a script where I populate both fields with sysID but it only works for the department field.

 

 

How to proceed with this document_id type field so it shows the name of the record?

 

 

 

 

 

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@dev_K 

what's your business requirement?

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

dev_K
Tera Contributor

I need to populate this field so it corresponds the Department field. 

 

For the context: In our environment we have loaded the entities and refers to existing record & applies to were not populated. So currently I am fixing by populating these fields.

@dev_K 

how are you updating that?

share script

Applies to is Document ID field type?

For setting Document ID you need to set table name along with Record SysId

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

Basically, first I retrieve the sysId I need and then update these fields:

 

   
    issueGR.setValue('refers_to_existing_table', true);
    issueGR.setValue('applies_to', departmentSysId);
 
 
This works. I see in the XML that the sysId is addedd to <applies_to> field but it results in displaying 'empty' (as shown in the screenshot above).
 
I need to know how can I precise which table this SysId resides in (FYI it is always cmn_department table).