how to get a variable value on ui page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2017 11:41 PM
Hi Developers,
I have a scenario here where i have used a ui page on a catalog form. I have a variable 'A' which is a select box on the catalog form and depending on the choice selected in variable 'A' when ui page is clicked it should download relevant template. for example when option 1 is selected in variable A then document 1 should get downloaded and when option 2 is selected then document 2 should be downloaded by clicking on ui page. Now i have no idea how to get the value of variable on the form in ui page to write if condition in to download the document. Can anybody help me out with solution please.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 12:10 AM
Hi Sagarika,
You can send it via a client script to the UI Page.
That is the place where you invoke the UI Page.
Send the variable parameter sample code below :
Client side-
var gDialog = new GlideDialogWindow('XYZ'); //UI page name
gDialog.setPreference('sysparm_variablename',"variablename");
in the ui page side -
<j:set var="jvar_xyz" value="${RP.getWindowProperties().get('variablename')}" />
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 12:11 AM
Hallo,
put an onclick event on the element in your UI page. Then, write the function you specified on the client script part of the ui page. You can use g_form.getValue on the client script part of the ui page.
Thanks,
a.c.manlangit
ServiceNow Developer - Philippines