Question

Displaying the printable based on a "type" selection

Hi Community,

 

Scenario : We have 6 request type [created a new section - request] and for each type there is a printable assigned. So, whenever we open a request type and click on the printable, we get all the 6 printables drop down.

 

Question: Is there a way we can restrict showing all the printables expect for the type we have selected while creating the request?

File attachments
Like 0

Like

2 comments

Hi Amritha,

 

Theoretically it is possible and to do that you will need to override the initCardPrintForms method on the edit page of your section. Please firstly see the basic method declaration in the PrintReportUtilities mixin.

 

There should be something like this in the edit page schema code:

//get the collection of all printables
var printMenuItems = this.get(this.moduleCardPrintFormsCollectionName);
printFormsMenuCollection.each(function(item) {
  item.set("Visible", {bindTo: "getPrintMenuItemVisible"});
}, this);

and then declare the custom logic in the getPrintMenuItemVisible method

getPrintMenuItemVisible: function(reportId) {
  //logic that returns true/false
}

Or you can use the preparePrintFormsMenuCollection method in the mixin and call it in your schema code:

preparePrintFormsMenuCollection: function(printForms) {
			printForms.eachKey(function(key, item) {
				if (!item.get("Caption")) {
					item.set("Caption", item.get("NonLocalizedCaption"));
				}
				item.set("Tag", key);
				if (item.get("TypeColumnValue")) {
					item.set("Visible", {bindTo: "getPrintMenuItemVisible"});
				}
			}, this);
		},

and again bind some logic to getPrintMenuItemVisible.

 

We don't have a ready example, but debugging the existing logic shouldn't be difficult.

 

Best regards,

Oscar

Hello Amritha,

If you still need help implementing this, I did a complete writeup of what is needed here: https://customerfx.com/article/showing-or-hiding-printables-based-on-a-…

Ryan

Show all comments