Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Print widget in service portal.

RudhraKAM
Tera Guru

As of now in my org people use ctrl+p to print the knowledge article but it is printing all the unnecessary things like  Top rated , top viewed etc ..

find_real_file.png

 

Our requirement is to 

 add a button(widget) at the bottom of the KB Articles that can be clicked to print just the KB article content,, I found this article  below where we can add the print image code in the KB article widget but we don't want to clone our KB article page ,, 

https://community.servicenow.com/community?id=community_question&sys_id=54c2dba1db101fc01dcaf3231f961963&view_source=searchResult

 

Our requirement : how to print the KB article content by clicking print (widget ) can some one help me with the code 

 

 

 

5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

You can enable print functionality with below code in your widget.

 

using this HTML:

 

                  <a href="{{data.ticketPrint}}" target="_blank" class="panel-button" title="Print">

 

                      <span class="glyphicon glyphicon-print"></span>

 

                  </a>

 

and corresponding server script:

 

 

 

        var u = data.table + '.do?sys_id=' + data.sys_id;

 

        data.ticketPrint = '/' + u + '&sysparm_media=print';

 

Regards,

Sachin

find_real_file.png

 

 

 

 

find_real_file.png

 

 

server side :   I checked with below both 

(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */

})();

var u = data.table + '.do?sys_id=' + data.sys_id;
data.ticketPrint = '/' + u + '&sysparm_media=print';

 

 

and 

 

(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */

 

var u = data.table + '.do?sys_id=' + data.sys_id;
data.ticketPrint = '/' + u + '&sysparm_media=print';

})();

 

 

RudhraKAM
Tera Guru

Any other suggestions please

RudhraKAM
Tera Guru

any other suggestions please?