Pass form value from UI Action to HTML in UI Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2022 09:08 AM
Hi
I have a requirement to hide few choice values of a field based on HR Service when the button is clicked.
When a user clicks "Rescind" button in Lifecycle event case, a dialog window appears and user is asked to submit Rescind reason.
My requirement is, based on the HR Service of the LE Case, i need to display certain choice values.
Backend code -
A UI Page is called in the UI Action which is displaying the choice values -
UI Action -
UI Page -
HTML -
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form id="LE rescind dialog">
<style type="text/css">
#le_rescind_dialog_footer input {
width: 100%;
}
.required-marker {
content: "*";
}
</style>
<script>
$j(document).ready(function() {
$j("#le_rescind_comment").focus();
});
alert("hello "+RP.getWindowProperties().get('sysparm_v1'));
</script>
<g:evaluate var="jvar_sysparm_v1" expression="RP.getWindowProperties().get('sysparm_v1')" />
<g:evaluate object='true' jelly='true'> var isRequired = 'true'; </g:evaluate>
<g:evaluate var="jvar_gr" object='true' jelly='true'> var reasons = JSON.parse(new
sn_hr_le.LifeCycleEventsClientCallableUtil().getRescindReasonsUIAction("${jvar_sysparm_v1}")); </g:evaluate>
The lines highlighted in red is how i am trying to pass HR Service as an argument to the script include but it is returning null.
Can anyone help me with correct syntax or any other way to pass a form value from UI Action to HTML in UI Page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2022 09:14 AM - edited 10-16-2022 09:14 AM
Hi Chenab,
I think you should use RP.getParameterValue("sysparm_v1") to capture HR Service .
Have a look at this post

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 07:06 AM
you should use this
<g:evaluate>
var sysIDCase = RP.getParameterValue("sysparm_case_sysId");
var hr= RP.getParameterValue("sysparm_v1");
gs.log("sysIDCase = " + sysIDCase + " / " + " hr = " + hr);
</g:evaluate>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 12:14 PM
You can use the example that ZAK gave and call this variable whenever you need.
<g:evaluate>
var sysIDCase = RP.getParameterValue("sysparm_case_sysId");
var hr = RP.getParameterValue("sysparm_v1");
</g:evaluate>
<div>
<p>ID: ${sysIDCase}</p>
<p>HR: ${hr}</p>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 02:05 PM
Parameters can be just accessed by name.
E.g. one could write
<script>
alert("sysparm_v1: $[ sysparm_v1 ]");
</script>
and when the said UI Page is invoked, one will get a prompt with the value of parameter sysparm_v1.
Note that I'm using $[ ] and not ${ }.
${ } is phase 1 expression, $[ ] is phase 2 expression.
(Jelly is evaluated in two phase - the 1st one is supposed to build the cached part of pages/macros, while the 2nd one the not-cached, dynamic part. So one would write stuff that does not change from one invocation to the next invocation for phase 1 and the stuff that changes from one invocation to the next for phase 2.)
The same variable can be accessed in evaluate Jelly nodes also by name:
<g2:evaluate jelly="true">
gs.info('sysparm_v1: ' + jelly.sysparm_v1);
</g2:evaluate>
Note again that I am using g2: namespace vs. g: namespace - same cached vs. dynamic part of a UI Page/UI Macro story.
Also note that I am indicating to the evaluator that I want to have access to Jelly variables (attribute jelly="true") and note that the parameter (sysparm_v1) is a property of the "global" jelly object.
A clarification: writing
alert("hello "+RP.getWindowProperties().get('sysparm_v1'));
would entirely be evaluated on client side, where there is no RP object and thus the entire script is invalid.
If one wants to evaluate something server side in a UI Page or UI Macro, that something has to be inside an evaluate node (<g:evaluate/> or <g2:evaluate/>) or inside Jelly expressions: ${ } or $[ ].