Hello, I need some help in printables . I want printable to be enabled based on Status . Example if status of selected record is Completed then printable must be enabled.
I have override "isSectionPrintFormEnabled" method in my section page as i noticed it is the method which bind to enabled value in "initSectionPrintForms" method in PrintReportUtilities . It is not working as expected as printable is always showing as disabled.
4. Add custom method, which will set the attribute value to true after status check on initialising the page. e.g.
methods:{
onEntityInitialized: function(){this.callParent(arguments);this.checkStatus();},
checkStatus: function(){
var status =this.get("Status").value;if(status !=="1f3ad326-effd-4ac3-a3e2-957e7def3684"){this.set("IsPrintableEnabled", true);}}}
Thank you for reply, I implemented the example as you have suggested.
It seems that when I am opening the record from my section view, it is still displaying the PRINT button. However, once the record is open, when I reload the same page, it's disabling the button - as expected.
My reasoning is 'onEntityInitialized' method is not available in the section page to change the status of the "IsPrintableEnabled" attribute.
in this case I would like to offer you to return to the approach overriding the PrintReportUtilities schema. Particularly draw your attention to getRowPrintButtonVisible method. It is responsible for displaying Print button in the rows, when clicking on records. As I understood this is of your interest. Please override this method to add status validation. The idea is that this method should return false in case status does not allow printables.
Also, you might be also interested in getCardPrintButtonVisible method responsible for the button in the section header.
Is it possible to run a printable from javascript code or custom added button?
I have a customer with several hundred merge forms they want to add to their Bpm'online system. The current print menus would be difficult to use with hundreds of printable merge forms listed, so I am looking at other possible ways to handle this. Open to any other suggestions.
You can explore, how printable is called in a Network section in a browser console. For example, that's why Account printable "Company summary" looks in a console:
In the example below you will find how you can do a similar task from c# in a script task. For example, the following code generates a printable and saves it in activity files:
var reportService =newTerrasoft.Configuration.ReportService.ReportService();
Is it possible to put some field in a document conditionally? For example, if some object has Paid flag set to true, we want to put payment amount but if not, then we want to put string Not paid.
If I make a printable template that uses a date field, the date gets formatted in US fashion. The same happens with numbers (dot is the decimal separator, not comma). Is it possible to set up the culture for generated documents explicitly?
In the current system version there is no option to sort the printables. Our R&D team is already aware of the request to allow the option and they are considering the possibility to include to improvement in one of the further system releases.
There is PrintReportUtilities mixin that is responsible for the printables functionality. The printable form is generated within initCardPrintForms and initSectionPrintForms methods. The click event is taken care of by generateCardPrintForm and generateSectionPrintForm methods.
To alter the logic of standard printables you need to override all these methods and add your custom filtration to them.
Alternatively, you can develop your own 'Print' button that will call the web-service directly. The example of such functionality can be found in generatePrintForm method of PrintReportUtilities (NUI) schema.
I would like to print a document which would include data from two entities: A and B. They are not connected directly though, instead there's an entity C that has lookups to both A and B. Just choosing C as the base entity for printable is probably not possible, because there may be many this kind of many-to-many relationships between A and other entities. Is it possible to create a printable document that includes data from A and those other entities?
In case you create a printable in C object, you can create two tables from A and B to get the info connected to the entity C. Please try to create such printables. I recommend you to test it. In case the tables are not connected at all, you won't be able to get the info from B to the printable based on A.
I don't think just creating a printable for C solves the problem, because there are more than one of this type of relationships between A and other entities. Let's say I have entity C with lookups to A and B and also entity Y with lookups to A and X. How can connect in a printable entities A, B, X?
You can make the field visible or hidden if the printable meets some conditions with the help of the development tools only. Please use the following script as an example for further investigation. It hides a form depending on a field value (if it’s less than 350 000 in this case) and you can alter it to reach your aim:
Please also note that such idea has been registered for our R&D team to include the functionality in the upcoming releases in the out-of-the-box version.
I have an Employee printable and I added some related tables, among them, Employee's career, where the IsCurrent field is Boolean, and the same in the report is shown with the value "True" or "False", there is a way to show "Yes" or "No" instead of "True" or "False"?
How can I add the Employee image to my printable template? I add the "Photo" field of the Contact associated to Employee to template but it show an Guid instead of the Photo.