
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 07:44 AM
Hello All,
I hope this one is simple but I really can't figure it out. I have a UI page with the line
<g:evaluate var="sysparm_number" expression="RP.getWindowProperties().sysparm_number" />
inside of the HTML code. This passes the 'number' field of my form to the HTML and it works great.
My next challenge is passing that same number to the Client Script section in the UI page, how would I go about referencing that sysparm_number variable or is there another way to reference it more directly in the client script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 08:02 AM
Hi,
Something like this
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>
<g:evaluate var="sysparm_number" expression="RP.getWindowProperties().sysparm_number" />
<input type="hidden" id="sysparm_number" name="sysparm_number" value="${sysparm_number}"/>
<table border="0" width="100%">
<tr>
<td>
<g:dialog_buttons_ok_cancel cancel="return onCancel();" ok="return onSubmit();"/>
</td>
</tr>
</table>
</g:ui_form>
</j:jelly>
Client Script:
function onCancel() {
GlideDialogWindow.get().destroy();
return false;
}
function onSubmit() {
return true;
}
Processing Script:
updateRecord();
function updateRecord() {
var app = new GlideRecord("tableName");
if(app.get('number', sysparm_number)){
app.field1 = 'Your Value';
app.update();
}
var urlOnStack = gs.getUrlOnStack();
response.sendRedirect(urlOnStack);
}
Regards
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
‎02-11-2021 07:48 AM
Hi,
Do you wish to send it via some trigger function?
Regards
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
‎02-11-2021 07:52 AM
Yes, what I want to do is have it go back to the originating record and add a note for the user. I tried doing this directly from my UI action but it had problems with rendering the UI page and updating the form at the same time so I am going to essentially have the UI Page do the update after it renders.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 07:53 AM
Hi,
you can store the value being passed in hidden html element
Then access the hidden html element value in the processing script, update the record
Regards
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
‎02-11-2021 07:56 AM
Do you have an example or can you point me to some documentation that does this for reference?