Good Evening, I am sure this is a very simple question. But I am having no luck finding a correct answer.
I have onLoad client script on a request form. The form has a variable that I need to auto populate, the value is on a sys_user extended table.
I am not sure how to pull that value from the sys_user extended table.
I know to use a GlideRecord to get the current user on the sys_user, but after that is were I am having the issue.
Thanks for any help or suggestions you may have.
James
As you mentioned, GlideRecord should be what you need to use. The exact script will vary based off of what field you are trying to query on your extended table.
var gr = new GlideRecord("extended_table_name");
gr.addQuery("field_name", "query");
gr.query();
if (gr.next()) {//action you want to take}
You can add as many addQuery() methods as needed to build the query as specific as you require. The query() method then runs the query and return a new GlideRecord object. The .next() method checks to see if there is another record in the GlideRecord object and advances to the next record if so. After running the script above, you can access any properties on the GlideRecord you may need by simply dotwalking to them. i.e:
sys_id = gr.sys_id;
name = gr.getDisplayValue();