Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to pass the table name from UI Action to UI Page?

zsquared
Tera Contributor

Hello!

 

I was wondering if anyone can help me with the following scenario:

I have a UI action set up on a list.  When clicked, the UI action creates a Custom Dialog Window where I would like to have a button that is linked to a different table.  I would like the table to filter for records that uses a query from the original table with the UI action.  

So far, I am only finding g_form results on how to pass values but I cannot have the UI on the form.  It must be on the list.

 

Any guidance would be appreciated!

 

Thank you!

 

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

You should be able to do something like this, in your UI Action: 

var yourDialog = new GlideDialogWindow("Your UI Page");
gDialog.setPreference('sysparm_table','this_table');

then in your Ui page use something like
 
<g:evaluate var="jvar_table" object="true">
var table = "${sysparm_table}"
table;
 </g:evaluate>

Then use ${jvar_table} to use the value...

If this was helpful, or correct, please be kind and remember to click appropriately!
I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

4 REPLIES 4

Michael Jones -
Giga Sage

You should be able to do something like this, in your UI Action: 

var yourDialog = new GlideDialogWindow("Your UI Page");
gDialog.setPreference('sysparm_table','this_table');

then in your Ui page use something like
 
<g:evaluate var="jvar_table" object="true">
var table = "${sysparm_table}"
table;
 </g:evaluate>

Then use ${jvar_table} to use the value...

If this was helpful, or correct, please be kind and remember to click appropriately!
I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Thank you so much! Didn't realize it was this simple.. was testing so many other ways.  

Glad I could help! It took me a while to figure out it was that easy as well. I won't even tell you some of the things I tried 🙂

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Hi Zhen,

Could you please help me with your complete code so that i can take a look from it.