- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 02:13 AM - edited 05-24-2023 02:14 AM
Hi,
I have a UI Page where I need some advice/help on how can we display the text retrieved in Client script and need to be passed to HTML?
Right now, I have the info in my client script which is coming from Script include but unable to display it in UI PAGE as not sure on how can we pass the value to HTML.
My code below:
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">
<b>Display Popup</b>
<br/>
<br/>
<g:evaluate var="jvar_current" expression="RP.getParameterValue('sysparm_record')"/>
<g:evaluate var="jvar_current_display" expression="RP.getParameterValue('sysparm_record_display')"/>
<table>
<tr><td style="width:25%;padding: 5px;">
<g:form_label>Label 1</g:form_label>
</td>
<td style="width:25%;padding:5px;">
<g:form_label>Label 2</g:form_label>
</td>
</tr>
<br/>
<tr>
<td class ="paddingBetweenCols" style="width:60%">
<g:ui_reference name="user_ref" id="user_ref" value="${gs.getUserID()}" displayvalue="${gs.getUser().getDisplayName()}" table="sys_user" />
</td>
<td class ="paddingBetweenCols" style="width:60%">
<g:ui_reference name="rec_details" id="rec_details" value="jvar_current" displayvalue="${jvar_current_display}" table="incident" />
</td>
</tr>
</table>
<br/>
<div>
<b>Users</b>
</div>
<br/>
<g:ui_form>
//Not sure if this is the crrect place I need to add my requirement to
</g:ui_form>
<style>
.paddingBetweenCols{
padding: 10px;
}
</style>
</j:jelly>
Client Script:
populateDetails();
function populateDetails() {
var getDetails = new GlideAjax('SI Name');
getDetails.addParam('sysparm_name', 'Fucntion Name');
getDetails.addParam('sysparm_recordID', g_form.getUniqueValue());
getDetails.addParam('sysparm_record_table', g_form.getTableName());
getDetails.getXMLAnswer(getDetails1);
}
function getDetails1(answer) {
var parseEmail = JSON.parse(answer);
I have the data in parse email. I just need help on how can we display or pass it to HTML
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 02:19 AM
what came in alert for parsing that subject?
can you try this hard-coded value?
document.getElementById('email_subject').innerHTML = 'testing';
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 12:00 AM
you have not created html element with id - email_body then how it will set
for subject do this
document.getElementById('email_subject').innerHTML= parseEmail.subject;
document.getElementById('email_subject').style.display = ''; // show the hidden element/tag
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 01:19 AM
There are 2 components to it
1. Email Subject
2. Email Body
Tried just with subject to see if this is working or not. It did not worked out .
I can remove the email body line from client script to avoid this confusion for now.
Please let me know if there is anything incorrect I am doing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 02:19 AM
what came in alert for parsing that subject?
can you try this hard-coded value?
document.getElementById('email_subject').innerHTML = 'testing';
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 01:25 AM
Thanks @Ankur Bawiskar that worked. There was a typo from my end.
Thank you so much for your time and help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 01:33 AM
Can you please help on another issue I am facing with UI Page posted below: