Using Document ID field

abhijeet_mody
Kilo Explorer

Hi folks -

 

I've a use case where I want to be able to relate a particular "Any" Service Now record (i.e a specific sys_id on any table) I discovered that this can be acheived by adding a field of type DocumentID on the table. Wiki provides information about how to configure it on a form .

 

However, I do not see more information about how to use that field within scripts to get to that particular related record.

 

Can someone help me with links to documentation if available .. or provide an example of how I can use the document ID field.

 

Regards,

Abhijeet

8 REPLIES 8

Bhavesh Jain1
Giga Guru

As far as scripting on Document ID field is concerned, there is no difference between reference field and document id field. You can use the same syntax to refer to this field.


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')):



Hope it answers your question.




Regards,


Bhavesh


IGate-logo.png


http://www.igate.com


Bhavesh Jain1
Giga Guru


Did that answer your question?


Hi Bhavesh -



Thanks for such a prompt response. I've been in training last couple of days.



I will try that today/tomorrow & verify. Thanks a ton!



Regards,


Abhijeet


Hi folks -



I tried the Document ID field & followed instruction from the Wiki to create the same.



However I don't see many tables visible in the drop down selection.


like Script Includes, Business Rules, UI Policies etc. I needed to build a reference to records from these tables & ideally I would like to use something on the same lines as the document id field so that I can store the references within 1 field.



Any suggestions ..??