Set Document ID via g_form

rako
Kilo Expert

Is it possible to see a populated value in a Document ID field on the UI that is set via script / g_form?   This answer is very close to what I am trying to do, but needs to update the UI.

I have a custom sys_id param set in the URL that populates a document ID field.

Setting the field on which the Document ID depends works as expected:

g_form.setValue("parent_table", "example_parent_table_name");

Setting the Document ID will populate the form correctly on submit, but clears out the view in the form.

g_form.setValue("parent_sys_id", "example_sys_id_123");

results in

SNOW_Document_ID_Cleared.png

You can see this same behavior by setting the document id manually (2nd example) from the javascript console.

Ideally I would like to demonstrate to the user that there is some sort of data that has been associated, whether the original that is populated correctly on-load, or the result of setting the g_form value via a script. Is there a method or recommendation for accomplishing this?

Thanks.

1 ACCEPTED SOLUTION

rako
Kilo Expert

So it turns out that the Document ID's dependent field had the data type of "Table Name" instead of "String", which caused the UI not to update.



The solution is to use "String" as a the data type instead of "Table Name".


View solution in original post

4 REPLIES 4

Hamza Berouil2
Tera Guru

What is the original need ?


I have a custom param in the URL that needs to populate a Document ID field.


As a workaround :



Have you tried to update it in the server side.



something like  



gr.parent_table = "the parent table name"


gr.parent_sys_id = 'the sys_if of the parent record"


gr.update();



If it works, then try to set up a GLideAjax in your client script.


rako
Kilo Expert

So it turns out that the Document ID's dependent field had the data type of "Table Name" instead of "String", which caused the UI not to update.



The solution is to use "String" as a the data type instead of "Table Name".