- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2020 11:02 PM
As i am a beginner in jelly scripting. I am facing issue to retrieve data from the custom table and to display that data in UI page. Can anyone help me with the script?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2020 10:07 PM
Hi Chandan,
You can do it in two ways:
in UI action you have to use setPreference and add the
the variable we have used is (no_of_cases) you can pass any value from the form to it as of now i have passed static 55 from ui action to ui page
var contactUIMacro = new GlideModal('sn_customerservice_Actives Cases with Same Contact', false, 'modal-lg');
contactUIMacro.setTitle('Active cases with same contact');
var noOfCases = '5';
contactUIMacro.setPreference('no_of_cases', '55'); //The new variable which you need to pass to UI page
contactUIMacro.render();
UI page:
you have to use the expression at the top and that variable you can use in the div tag.
<?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:evaluate var="jvar_num_case"
expression="RP.getWindowProperties().get('no_of_cases')" />
<div class="form-group">
<p>There are currently ${jvar_num_case} active cases with the same contact.</p>
</div>
</j:jelly>
Mark helpful and correct if it helps.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2020 02:10 PM
Hi Chandana,
How are you using the UI page from custom table Is it by clicking of a UI action which will call the Dialog window and there you need the value of which you will pass through dialogwindow?
Can you provide more details on that?
Thansk,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2020 09:20 PM
Hii CB,
Yes, I am calling a UI page by clicking the button in UI action as a glide dialog window. I need the values to be displayed in the main UI page which i have passed through glide dialog window.Can u plz help in this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2020 10:07 PM
Hi Chandan,
You can do it in two ways:
in UI action you have to use setPreference and add the
the variable we have used is (no_of_cases) you can pass any value from the form to it as of now i have passed static 55 from ui action to ui page
var contactUIMacro = new GlideModal('sn_customerservice_Actives Cases with Same Contact', false, 'modal-lg');
contactUIMacro.setTitle('Active cases with same contact');
var noOfCases = '5';
contactUIMacro.setPreference('no_of_cases', '55'); //The new variable which you need to pass to UI page
contactUIMacro.render();
UI page:
you have to use the expression at the top and that variable you can use in the div tag.
<?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:evaluate var="jvar_num_case"
expression="RP.getWindowProperties().get('no_of_cases')" />
<div class="form-group">
<p>There are currently ${jvar_num_case} active cases with the same contact.</p>
</div>
</j:jelly>
Mark helpful and correct if it helps.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2020 10:33 PM
Hi Chandana,
below is the sample code
You can enhance it as per your need
UI Action:
Onclick: showRecord()
Script:
function showRecord(){
var sysId = g_form.getUniqueValue();
var gDialog = new GlideDialogWindow('show_incident_details');
gDialog.setSize('600','600');
gDialog.setPreference('id', sysId);
gDialog.setTitle('Show Incident');
gDialog.render();
}
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">
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
tr:nth-child(even){background-color: #f2f2f2}
th {
background-color: #4CAF50;
color: white;
}
</style>
<g:evaluate var = "jvar_id" expression="RP.getWindowProperties().get('id')"/>
<h1>Incident Summary</h1>
<g:evaluate var="jvar_inc" object="true">
var inc = new GlideRecord('incident');
inc.get('${jvar_id}');
inc;
</g:evaluate>
<table border="1">
<tr>
<td>Number</td>
<td>Assignment Group</td>
<td>Priority</td>
<td>Company</td>
<td>Caller</td>
</tr>
<tr>
<td id="number">$[inc.number]</td>
<td id="assignment_group">$[inc.assignment_group.getDisplayValue()]</td>
<td id="priority">$[inc.priority.getDisplayValue()]</td>
<td id="company">$[inc.company.getDisplayValue()]</td>
<td id="caller">$[inc.caller_id.getDisplayValue()]</td>
</tr>
</table>
</j:jelly>
Output:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader