How pass parameter from UI Macro to UI Page HTML?

nickfarrenkopf
ServiceNow Employee

I am trying to pass parameters from a UI Macro to a UI Page. The macro is a button that, when clicked, opens up a GlideDialog (that calls my UI page) on screen. I am trying to pass parameters to this modal popup.

I have successfully passed parameters to the Client Script side of the UI Page, but my issue is that I have been unable to access/save any parameters from the HTML/XML section of the UI Page. GlideModal is accessible from the <script> section, but 'GlideModal' is not defined when accessed via the <g:evaluate> or any other glide tags I have tried.

UI MACRO

var modal = new GlideModal(UI_Page, readOnly, width);

modal.setPreference('referenceField', 'myField');

modal.setPreference('inputBoxDefaultText', 'Keyword Search');

UI PAGE - Client Script

// successful access and use

var modal = GlideModal.get();

var referenceField = modal.getPreference('referenceField');

UI PAGE - HTML

// successful access of params, but have not figured out how to access this param via jelly/glide -> SEMI SUCCESS

<script>

        var modal = GlideModal.get();

        var test = modal.getPreference('inputBoxDefaultText');  

</script>

// GlideModal is not defined -> FAIL

<g:evaluate>

        var modal = GlideModal.get();

</g:evaluate>

// test variable created in script does not exist -> FAIL

<g:evaluate>

        gs.log('My var ' + test);

</g:evaluate>

If I could figure out a way to access the script variables in the g:evaluate tags, that would be ideal. Anybody have any ideas/solutions?

1 ACCEPTED SOLUTION

nickfarrenkopf
ServiceNow Employee
2 REPLIES 2

Ankur Bawiskar
Tera Patron

Hi Nick,



you can check below links:


How To Get Parameters/Values From a URL in ServiceNow | SN Commander


http://wiki.servicenow.com/index.php?title=Extensions_to_Jelly_Syntax#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


nickfarrenkopf
ServiceNow Employee

Found the answer on another page.



How do I pass values to UI Page with glideModal?