Running and Downloading a Printable via Javascript in Creatio

To run/create a printable in Creatio via client-side Javascript on a page, there’s an easy to use web service. We can also use the ServiceHelper module to make it easy to create the printable document as well.

To run a printable and download the doc via code, first add the ServiceHelper module to the modules list at the top of the page. Additionally, if we want to show the “loading” animation while the printable is being created, we can also add the MaskHelper module as well.

define("UsrMyCustom1Page", ["ServiceHelper", "MaskHelper"], function(ServiceHelper, MaskHelper) {

With the modules added to the top of the page, the code to create the printable document would look as follows:

// Notę, the reportId below is the Id of the printable.
// You can get this from the end of the URL when edit the printable in the report setup screen
var reportId = "7f5de1ad-fb4b-2ad6-b6fc-4f05f30a7f0f";

// we'll pass the below to the service. The recordsIds is the record (or records) the printable will be run for				
var serviceData = {
	"templateId": reportId,
	"recordIds": [ this.get("Id") ]

// show loading indicator
// call the service
ServiceHelper.callService("ReportService", "CreateReportsList", function(response) {
	// now download the file
	var elem = document.createElement("a");
	elem.href = "../rest/ReportService/GetReportFile/" + CreateReportsListResult[0]; = "ReportName";
	if (Ext.isIE) { = "_blank";
}, serviceData, this);

The result is that when the code above executes, the printable will be created and downloaded. The user will simply see a quick loading animation and then a file will download.

Want content like this delivered to your inbox? Sign up for our newsletter!

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *