what does RP.getWindowProperties().get('text') do in <g:evaluate var="jvar_text" expression ="RP.getWindowProperties().get('text')" />?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 11:24 PM
what does RP.getWindowProperties().get('text') do in <g:evaluate var="jvar_text" expression ="RP.getWindowProperties().get('text')" />?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 11:27 PM
Hi Mallikharjuna,
RP.getWindowProperties() is used to get value of any parameter passed in url
mostly it is used in UI pages, UI macros etc
the name of the url parameter is sent into get method; for example below the url parameter name is text
<g:evaluate var="jvar_text" expression ="RP.getWindowProperties().get('text')"
https://docs.servicenow.com/bundle/helsinki-application-development/page/script/client-scripts/reference/r_DisplayingACustomDialog.html
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 01:00 AM
when ever one field value is selected, UI page open. Could you please tell me if UI Page is getting triggered from onChange Client script?
HTML:
<style>
/* dialog styles */
.dialog_content {
width: 100%;
vertical-align: top;
min-width: 450px;
text-align: center;
padding: 8px 0 0 20px;
}
.dialog_data {
width: 100%;
vertical-align: top;
text-align: left;
padding: 0px 5px 20px 60px;
}
.dialog_buttons {
display: inline;
text-align: right;
vertical-align:bottom;
white-space: nowrap;
}
.dialog_buttons_row {
text-align: right;
}
.dialog_left_icon {
font-size: 300%;
vertical-align: top;
}
.dialog_left_icon_confirm {
color: #6CE474;
}
</style>
<g:ui_form onsubmit="return triggerCallback('ok');">
<g:evaluate var="jvar_text" expression ="RP.getWindowProperties().get('text')" />
<g:evaluate var="jvar_ci" expression="RP.getWindowProperties().get('ci')" />
<g:evaluate var="jvar_assignment_group" expression="RP.getWindowProperties().get('assignment_group')" />
<g:evaluate var="jvar_supplier" expression="RP.getWindowProperties().get('supplier')" />
<table border="0" width="100%">
<tr>
<td class="dialog_content">${jvar_text} </td>
</tr>
<tr>
<td class="dialog_data"> <br> <b> Configuration Item:  </b> ${jvar_ci}</br> <br><b> Assignment Group:  </b> ${jvar_assignment_group} </br> <br><b> Supplier:  </b> ${jvar_supplier} </br> </td>
</tr>
<tr class="dialog_buttons_row">
<td class="dialog_buttons">
<g:dialog_buttons_ok_cancel ok="triggerCallback('ok');" ok_type="button"
cancel="triggerCallback('cancel')" cancel_type="button"/>
</td>
</tr>
</table>
</g:ui_form>
Client:
function triggerCallback(type){
var gdw = GlideDialogWindow.get();
if (type == 'ok'){
var gr = new GlideRecord('sys_user_group');
gr.addQuery('name',gdw.getPreference('assignment_group'));
gr.query();
if(gr.next()){
g_form.setValue('assignment_group',gr.sys_id);
}
gdw.destroy();
}
else if (type == 'cancel')
gdw.destroy();
}
in client script , gdw.getPreference('assignment_group')); from where preference is coming, could you please explain the above code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 01:12 AM
Hi Mallikharjuna,
It is getting the preference i.e. the value of assignment_group from the url parameter
As you said on change of field you are calling the UI page that client script is sending value of assignment_group to the UI page and you are accessing it using getPreference()
check example below
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2019 08:37 PM
Hi Mallikharjuna,
Any update on this?
Can you mark my answer as ✅ correct, 👍 helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader