How to set Document ID field using GlideRecord

mukki
Kilo Contributor

Hi ,

I am trying to insert record using GliderRecord in table chat_message but i am not able to set the To and From field.I haven't worked with Documnet ID type fields.

Can anyone please suggest how i can populate those document id field using Glide Record

1 ACCEPTED SOLUTION

domaners
Kilo Guru

Hi Mukesh, the field is called to_id, so set current.to_id = sys_id. from_id is the name of the From field. You may also need to set the to_table and from_table with the name of the tables that the document is coming from as well, for instance:



current.to_id = incident.sys_id;


current.to_table = 'incident';


View solution in original post

12 REPLIES 12

Harish KM
Kilo Patron
Kilo Patron

HI



For Server side scripting you can use this :



gs.addInfoMessage('Document sys id -->'+current.u_document_id);


gs.addInfoMessage('Document Display name -->'+current.u_document_id.getDisplayValue());



For Client side you can do :



alert(g_form.getValue('u_document_id')):


Regards
Harish

mukki
Kilo Contributor

Hi Harish ,



I already tried with that solution but still not able to populate the value.


manikorada
ServiceNow Employee
ServiceNow Employee

Mukesh,



Try to do floowing:


current.document_id = '<<sys_id>> of the record';


domaners
Kilo Guru

Hi Mukesh, the field is called to_id, so set current.to_id = sys_id. from_id is the name of the From field. You may also need to set the to_table and from_table with the name of the tables that the document is coming from as well, for instance:



current.to_id = incident.sys_id;


current.to_table = 'incident';