In this scenario, I have used two distinct controls. Implement a Business Rule which sets/updates this lookup field whenever its corresponding input data field changes so that it has a correct representation of the data in the generated document.Add a lookup field which references the “Control Representation” entity.Now, for any control that needs to be printed on the document, you need to do 2 things in your app to your target entity for document template: Before discussing more details on this master table, let’s assume it exists and holds all those images. The reason to have all these images in one place in the form of a master table is that I can reuse these same images in any other entity that needs to have a document template with any of those controls printed. In terms of designing the solution, I am going to create a master table (custom entity) called “Control Representation” which will hold images of all possible states of the controls I intend to print. I will be displaying the controls as images in the document and I will make sure that I have a way to use correct image based on the input to the 3 controls I have listed above. I will map the Yes/No flip control to a checkbox (checked/unchecked) as this looks better in a printed document. This makes a total of 3 controls that I will be adding to the generated document. Note that I already have the original Yes/No flip switch to indicate agreement to the T&C which has to be set to Yes.Start Rating – This is another custom control allowing you to rate from 1-5.Yes/No switch – Consent for any product related promotional communication.Scenarioįor the sake of this post, I am going to reuse the model-driven app from my previous post and add a few input elements/controls to demonstrate the solution.Īs you can see in the following screenshot, I have added two additional fields to my Undertaking Form: The generation of the document is only going to create a document with the necessary data from CDS, displayed in a well formatted manner. This also means that when I am going to display, say, a checkbox or a star rating, it will only be a visual representation and not an interactive/functional control in the word document and this may be acceptable solution in most of the scenarios because your interaction is most likely going to happen with the app UI rather than the document. I will be building some conditions in PowerApp and the display in word template would be a simple mapping exercise. I am not going to build any conditions in the word template itself i.e.
Therefore, any solution to meet this requirement without relying on any 3rd part add-on is going to be a workaround.īefore discussing the solution, let me be clear here. Apparently, it is a simple requirement but when it comes to the capability of Document Templates, there is no straightforward way to achieve it. Recently, one of the community members stated a requirement where he needed to display the checkbox checked/unchecked conditionally and this is what I will be discussing in this post.
However, if I had to just display a checkbox with the T&Cs clause, I could have added just a static checkbox control as checked (ticked)in the template which may have been fine because the UI did not allow you to save it without marking it as Yes. My input form had the T&Cs Yes/No as mandatory and therefor it had to be set to Yes before you could save the record and that was directly reflected in the clause without needing a checkbox as checked. If you have read my post on Capturing and printing on document template using Pen Control and Microsoft Flow, you may have noticed that while the input form had a Yes/No flip control (which is equivalent to a checkbox without the use of flip control) and the generated document did not have that checkbox on the document itself. Adding Checkbox or Star Rating To Word Document Template