The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Setting Value for Document ID field

mangesh9
Mega Contributor

Hello,

Through scripting I am setting value(sys_id of record from XYZ table) for field of Document ID type while inserting record in that table, not sure how to point the XYZ table so that document ID field will allow to set value, can anybody suggest please?

3 REPLIES 3

Deepa Srivastav
Kilo Sage

Can you elaborate more and provide related code...



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.


Thanks,
Deepa


Chuck Tomasi
Tera Patron

Hi Mangesh,



A document ID field really needs a dependent table field. The two go together. The table field is of type "Table name". See the dictionary entry for sysapproval_approver table's   document_id field as an example how this is done.



find_real_file.png



Reference: Creating a Document ID Field - ServiceNow Wiki


Mihir Mohanta
Kilo Sage

You should define table name before setting value in document id type field.


Write script like :



current.u_table = 'XYZ ';   // Write table name of the XYZ table and field name in place of u_table.


current.u_doc_id = "SYS_ID" ;// write sys_id of the record in place of SYS_ID


current.update();  



Thanks,


Mihir