PrintReportUtilities override methods always need refresh

Hi,

I have implemented two different scenarios using PrintReportUtilities mixin methods. The first one (generateCardPrintForm) is to save the printable as an attachment in the Attachment and Note detail, and the other one (initCardPrintForms and preparePrintFormsMenuCollection) is used to filter the printables on the basis of lookup. The code is working fine but after refreshing the page.

 

The code used in OrderPageV2 is as follows

generateCardPrintForm: function(tag) {
	// first get the printable being accessed
	var printFormsCollection = this.get(this.moduleCardPrintFormsCollectionName),
		printForm = printFormsCollection.get(tag);
	var printableId = printForm.values.Id;
	var orderId = this.get("Id");
	ProcessModuleUtilities.executeProcess({
		sysProcessId: '68880f82-xxxx-xxxx-xxxx-xxxxxfb532c2',
		parameters: {
			OrderId: orderId,
			PrintableId: printableId
		}
	});
	this.updateDetail({detail: "Files"});
	this.callParent(arguments);
}

 

initQueryColumns: function(esq) {
	this.callParent(arguments);
 
	if (!esq.columns.contains("UsrDocumentRepositorySubtype")) {
		esq.addColumn("UsrDocumentRepositorySubtype");
	}
},
initCardPrintForms: function() {
	this.callParent(arguments);
	var printMenuItems = this.get(this.moduleCardPrintFormsCollectionName);
	if (Ext.isEmpty(printMenuItems)) return;
	printMenuItems.each(function(item) {
		item.set("Visible", {bindTo: "getPrintMenuItemVisible"});
	}, this);
},
initSectionPrintForms: function() {
	this.callParent(arguments);
	var printMenuItems = this.get(this.moduleSectionPrintFormsCollectionName);
	if (Ext.isEmpty(printMenuItems)) return;
	printMenuItems.each(function(item) {
		item.set("Visible", {bindTo: "getPrintMenuItemVisible"});
	}, this);
},
preparePrintFormsMenuCollection: function(printForms) {
	printForms.eachKey(function(key, item) {
		if (!item.get("Caption")) {
			item.set("Caption", item.get("NonLocalizedCaption"));
		}
		item.set("Tag", key);
		item.set("Visible", {bindTo: "getPrintMenuItemVisible"});
	}, this);
},
// this is the function will determine if a printable is visible
// it is called for each printable and will return true/false to show or hide
getPrintMenuItemVisible: function(reportId) {
	var type = this.get("Status") || { displayValue: "" },
		printMenuItems = this.get(this.moduleCardPrintFormsCollectionName),
		item = printMenuItems.find(reportId);
	if (Ext.isEmpty(item)) return;
 
	switch (item.get("Caption")) {
		case "Order - Inprocess":
			return type.displayValue === "3. In progress";
		default:
			return type.displayValue != "3. In progress";
	}
}

 

Like 0

Like

4 comments

Hello,

 

It happens because of the combined mode and the fact that logic is triggered not from the page itself, but from the section page (when you open record from the section) until the page is reloaded. It's the same issue as if you add buttons to the page schema, not section schema (as described here). In such case you won't be able to see buttons on the page until the page reload. So you need to modify the logic and apply it in the section schema (OrderSectionV2).

Oleg Drobina,

 

I have added the code to OrderSchemaV2, but the issue is still the same.

Syed Ali Hassan Shah,

 

Unfortunately additional debugging needed here. Also there is a probability that the whole approach should be changed. Here are also two marketplace addons, one of them performs filtration of printables and another one adds printables to attachments:

 

https://marketplace.creatio.com/app/printable-attachments-creatio

https://marketplace.creatio.com/app/opportunity-printables-filtering-roles-creatio

 

You can also review how they work and maybe it will help in implementing your own logic.

Oleg Drobina,

 

I have gone through the mentioned plugins they are using the custom implementation in their own developed buttons and custom library. But we want to override the implementation done by Creatio.

 

Show all comments