- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 07:56 AM
My users have asked me to allow them to print their form. Export to PDF was differently the simple answer. The problem is that use the form to have contractors sign and date their work. SO they print out the form and have the contractor sign it. The form itself has quite a few Annotations(text) on it. So when I create a PDF the text do not display.
Is this the right approach to resolve the text problem?
It possible to create a UI action on the form that will open a UI Page that just displays the form in read only?
Is there an existing script call that will display form in the page or do you have to move it field by field?
I have never worked in a UI Page before, so any help and advice is greatly appreciated!
Thanks
jateater
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 08:44 AM
You can indeed have a 'print' ui action/button which points to a UI Page for a nicer layout, here's an example I have on change which points to a change_view ui page, useful in this instance for printing all the related tasks/approvals etc.
Client callable UI Action Code
// printing from a list
function printPreviewList(sysid) {
var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
var url = new GlideURL('change_view.do');
url.addParam('sysparm_change', sysId );
var w = getTopWindow();
var newWindow = w.open(url.getURL(), "_blank");
newWindow.focus();
return false;
}
UI Page change_view(I haven't pasted the whole thing but should give you the idea).
note the quite handy print button/icon is included.
<?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_id" expression="RP.getWindowProperties().get('id')"/>
<j:set var="jvar_change_id" value="${sysparm_change}" />
<h1>Change Summary</h1>
<div style="height: 20px" class="print_hide" align="right">
<button type="submit" onclick="javascript: window.top.print();"><img src="images/printer.gifx"></img>
<span>Click to Print</span>
</button>
</div>
<g2:evaluate var="jvar_inc" object="true">
var inc = new GlideRecord('change_request');
inc.get('${jvar_change_id}');
inc;
</g2:evaluate>
<table class="red" cellpadding="0">
<tr>
<td style="text-align: left;" >Number:</td><td width="400px" style="text-align: left;" >$[inc.number]</td>
<td style="text-align: left;" >Title:</td><td style="text-align: left;" >$[inc.short_description]</td></tr><tr>
<td style="text-align: left;" >Phase:</td><td style="text-align: left;" >$[inc.phase.getDisplayValue()]</td>
<td style="text-align: left;" >Phase State:</td><td style="text-align: left;" >$[inc.phase_state.getDisplayValue()]</td></tr><tr>
<td style="text-align: left;" >Impact:</td><td style="text-align: left;" >$[inc.impact.getDisplayValue()]</td>
<td style="text-align: left;" >Risk:</td><td style="text-align: left;" >$[inc.risk.getDisplayValue()]</td></tr><tr></tr><tr>
<td style="text-align: left;" >Planned Start:</td><td style="text-align: left;" >$[inc.start_date.getDisplayValue()]</td>
<td style="text-align: left;" >Planned End:</td><td style="text-align: left;" >$[inc.end_date.getDisplayValue()]</td></tr><tr></tr><tr>
</tr>
</table>
<g2:evaluate var="jvar_approvers" object="true">
var approvers = new GlideRecord('sysapproval_group');
approvers.addQuery('parent','${jvar_change_id}');
approvers.query();
approvers;
</g2:evaluate>
<j2:set var="jvar_approver_count" value="$[approvers.getRowCount()]"/>
<br />
<h1>Approval Groups: $[jvar_approver_count]</h1>
<j2:while test="$[approvers.next()]">
<table class="red" cellpadding="0">
<tr>
<td width="120px" style="text-align: left;" >Group:</td><td width="400px" style="text-align: left;" >$[approvers.assignment_group.getDisplayValue()]</td>
<td width="120px" style="text-align: left;" >State:</td><td style="text-align: left;" >$[approvers.approval.getDisplayValue()]</td></tr><tr>
</tr>
</table>
</j2:while>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 08:44 AM
You can indeed have a 'print' ui action/button which points to a UI Page for a nicer layout, here's an example I have on change which points to a change_view ui page, useful in this instance for printing all the related tasks/approvals etc.
Client callable UI Action Code
// printing from a list
function printPreviewList(sysid) {
var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
var url = new GlideURL('change_view.do');
url.addParam('sysparm_change', sysId );
var w = getTopWindow();
var newWindow = w.open(url.getURL(), "_blank");
newWindow.focus();
return false;
}
UI Page change_view(I haven't pasted the whole thing but should give you the idea).
note the quite handy print button/icon is included.
<?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_id" expression="RP.getWindowProperties().get('id')"/>
<j:set var="jvar_change_id" value="${sysparm_change}" />
<h1>Change Summary</h1>
<div style="height: 20px" class="print_hide" align="right">
<button type="submit" onclick="javascript: window.top.print();"><img src="images/printer.gifx"></img>
<span>Click to Print</span>
</button>
</div>
<g2:evaluate var="jvar_inc" object="true">
var inc = new GlideRecord('change_request');
inc.get('${jvar_change_id}');
inc;
</g2:evaluate>
<table class="red" cellpadding="0">
<tr>
<td style="text-align: left;" >Number:</td><td width="400px" style="text-align: left;" >$[inc.number]</td>
<td style="text-align: left;" >Title:</td><td style="text-align: left;" >$[inc.short_description]</td></tr><tr>
<td style="text-align: left;" >Phase:</td><td style="text-align: left;" >$[inc.phase.getDisplayValue()]</td>
<td style="text-align: left;" >Phase State:</td><td style="text-align: left;" >$[inc.phase_state.getDisplayValue()]</td></tr><tr>
<td style="text-align: left;" >Impact:</td><td style="text-align: left;" >$[inc.impact.getDisplayValue()]</td>
<td style="text-align: left;" >Risk:</td><td style="text-align: left;" >$[inc.risk.getDisplayValue()]</td></tr><tr></tr><tr>
<td style="text-align: left;" >Planned Start:</td><td style="text-align: left;" >$[inc.start_date.getDisplayValue()]</td>
<td style="text-align: left;" >Planned End:</td><td style="text-align: left;" >$[inc.end_date.getDisplayValue()]</td></tr><tr></tr><tr>
</tr>
</table>
<g2:evaluate var="jvar_approvers" object="true">
var approvers = new GlideRecord('sysapproval_group');
approvers.addQuery('parent','${jvar_change_id}');
approvers.query();
approvers;
</g2:evaluate>
<j2:set var="jvar_approver_count" value="$[approvers.getRowCount()]"/>
<br />
<h1>Approval Groups: $[jvar_approver_count]</h1>
<j2:while test="$[approvers.next()]">
<table class="red" cellpadding="0">
<tr>
<td width="120px" style="text-align: left;" >Group:</td><td width="400px" style="text-align: left;" >$[approvers.assignment_group.getDisplayValue()]</td>
<td width="120px" style="text-align: left;" >State:</td><td style="text-align: left;" >$[approvers.approval.getDisplayValue()]</td></tr><tr>
</tr>
</table>
</j2:while>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2021 01:57 PM
Hello,
how can we hide fields which have no input or false input. just to enhance user readability.
I have a UI page which is re-directed when user submits a record producer but I am unable to hide empty and false values in IT view and Service portal view.
please help!
Thanks!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2021 08:29 AM
Hello Florida,
Good to see this post, i have the same issues as you mention, need to hide some of the empty fields and the comment added.
If you have any solution, please share here, if will be helpful.
Thank you so much.