Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

UI Page Query

dhirajwakodikar
Kilo Expert

I have created 2 UI pages, 1st ui page contains certain fields and a create button. When all fields are filled and button is clicked, it inserts all data in a table which contains similar fields and also opens a popup which is the 2nd ui page.

The 2nd UI page also contains fields and an 'Add' button on clicking of which i should display values of both 1st and 2nd ui page in the 2nd ui page only in tabular form.

i managed to link 2 UI pages, snapshots:

find_real_file.png

The page with fields tracker number, name etc is my 1st ui page and the table format is the 2nd ui page. After i click on add task on 2nd ui page, all values from 1st and 2nd ui page should appear.

How do i achieve this ?

I searched and came to know about passing values to url however i am not redirecting to url here because i want it to open in same window. The code that i am using for redirection is:

var dd = new GlideDialogWindow("Demand Task form"); // Demand Task form is 2nd ui page's name

dd.render();

Any help on this please.

4 REPLIES 4

Ankur Bawiskar
Tera Patron

Hi Dhiraj,



you can pass values while calling the ui page through GlideDialogWindow using setPreference().


Example below:



sending values to ui page 2



dd.setPreference('table', 'incident_list');


dd.setPreference('sysparm_view', 'default');



getting values in ui page 2


highlighted in bold are the first parameters of setPreference()



<g:evaluate var="jvar_short_text" expression="RP.getWindowProperties().get('table')" />


<g:evaluate var="jvar_comments_text" expression="RP.getWindowProperties().get('sysparm_view')" />



http://wiki.servicenow.com/index.php?title=Displaying_a_Custom_Dialog#gsc.tab=0



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Anurag,



That was really helpful. I am now able to fetch values in 2nd ui page. However, how do i ensure that the info is displayed only after i click the add task button and not otherwise ?


I mean if i directly write table tags and insert these fetched values, it displayes the table and values by defacult which is not my requirement. I only want to display the fetched value after the 'Add task' button is clicked.



I assume onclick also won't help because i can't use html code in client script.


Any suggestions ?


David Stutter
Tera Guru

The GlideDialogWindow class has a setPreference function, in which you have access on these variables in the code:


https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GDW-setPreference_S_S



"When all fields are filled and button is clicked, it inserts all data in a table" ->


does this means the data is already saved in a gliderecord in the backend? Therefore you can also get the data from the gliderecord from the 1st page on the 2nd page.