Hi, I have developed a custom template for pro-forma Invoice report. I have uploaded it on sales invoice report form on Docentric in D365FO. Now I can see there are two templates one the default one and the other this custom made template.
As we already know that the proforma invoice report is run after we select a open order sales order from the sales order list page form and click on ‘Proforma Invoice’ button under Invoice tab in Generate group.
What I want to do is I want to create a new button just under this OOB button named ‘custom proforma Invoice’, for example, but when I click on it, I would like to run the new custom template while the out-of-the-box button should keep on running the default template.
Please guide me how can I do it ?
Anyone from Docentric ?
Hi @waqas_ahmed,
Usually, in standard D365FO, conditional printing like this is managed through the Print Management framework. There, you can define conditions for documents such as the Proforma invoice, and based on those conditions, select the corresponding template in your setup.
Did you try this option already?
Hi Amir, Thanks for the reply. Actually, we have two more templates for sales invoice report. We are catering those through print management. So, the question is, can we also handle this proforma invoice scenario through print management ? Can you please show me how can I do that, like how will I tell which template to pick for which button ?
Hi @waqas_ahmed,
I’m not sure how your print managment setup looks right now, but if you already have conditional printing based on two conditions and different templates, then you’ll also need to handle this same logic for the Proforma scenario.
So basically, you’ll need to keep the two existing conditions and there you set Proforma to No, and then add the same two conditions again, but for when Proforma = Yes. That way, both “regular” and “proforma” cases are covered with the right logic.
Let’s say I have a different condition, for example, language is en-US and the report is a proforma. Then it should be something like:
But please make sure to test it with all your scenarios to confirm it works as expected.
Great. But what about the other button ? How the new custom proforma template will trigger upon clicking of that button ? Please explain in detail.
Hi @waqas_ahmed,
Not sure what you mean by “other button.”
The system will detect that this document is a Pro forma invoice, and based on that, it will automatically follow the right logic depending on the conditions you’ve set up.
Could you please explain why you think you need a separate button?
Actually, I have created a new button just under Out of the box proforma invoice button. The requirement is, the out of the box button will run the proforma invoice report with default template while my custom button will run the custom template. This is what I want to achieve.
Hi @waqas_ahmed,
Companies handle this situation by using only one, standard menu item, and configuring default and conditional Print management. One of them, let’s say conditional Print management is executed in case of proforma invoice, and there you configure the template you need for that scenario, while the other, let’s say default Print management, is executed for the posted invoice and you configure it to use the matching template.
If you don’t like the OOTB solution, then you will need to handle the different menu items in the report controller. This requires standard D365FO development, nothing Docentric-specific, and there are many resources on this topic online. Then finally in the Docentric DSP class, in the overrideReportRunSettings() method, you would implement the additional logic to use the template required for a given scenario.
You can find a sample code in this manual:

