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

How to Parse Document ID Field?

Binh Truong2
Mega Expert

Hello world!

We have a document ID type field named "Trigger ID". This field is auto populated by the system which concatenates the related table and number. I need to find a way to parse out only the number (highlighted in yellow) so i can use to copy onto a new reference field on the same form. Any idears? Thanks

find_real_file.png

1 ACCEPTED SOLUTION

srinivasthelu
Tera Guru

HI Binh,



reference field accepts Sys_id's so, You can do a simple assignment and that should work.



gr.u_target_refereence_field=gr.u_target_id;


View solution in original post

6 REPLIES 6

srinivasthelu
Tera Guru

HI Binh,



reference field accepts Sys_id's so, You can do a simple assignment and that should work.



gr.u_target_refereence_field=gr.u_target_id;


Confirmed pulling the sys_id of the document ID worked.


Chuck Tomasi
Tera Patron

If you want just the number value, do something like this (business rule example)



var display = current.u_trigger_id.getDisplayValue();


var number = display.split(' ')[1];


Thanks for the quick reply Chuck!