Generate PDF from page action receives outdated entity

0
I'm trying to generate a pdf using the PDF Document Generation module from the Marketplace. However, whenever I do create a pdf, the data is outdated and different from what I passed. 1. OrderConfirmation entity is committed and set as the context for the "Generate PDF from page" java action. 2. That same OrderConfirmation entity is passed to ShowTemplate, which opens the template page before the actual PDF generation action. 3. ShowTemplate is called with OrderConfirmation as page parameter. My original OrderConfirmation is passed with outdated data, meaning data from the last time I tried to generate a pdf.   The microflow in question:     Settings for Generate PDF from page:   ShowTemplate:   Page settings from ShowTemplate:   Example:   Left is the OrderConfirmation I passed, right before the action is called. Right is the OrderConfirmation that ends up in ShowTemplate one step later. Note that 1) OrderConfirmation was committed already with the new data and 2) the entity ID is the same, so it's the exact entity I passed, just the data doesn't reflect the latest commit for some reason.   Things I've tried: - Deleting and installing the module again - Extracting the "Generate pdf from page" and "Download pdf" action to a submicroflow - Passing an associated entity (1-1 relationship) to the ShowTemplate microflow and getting the OrderConfirmation through the relationship - Creating a duplicate of OrderConfirmation to pass to ShowTemplate and deleting it right after pdf creation is finished. In that case, the OrderConfirmation in ShowTemplate ends up being null/empty.     Am I missing something really obvious here, or is this some kind of bug?
asked
2 answers
3

Nathalie, this is probably due to the following limitation of the Microflow used in the PDF document generation action (see documentation):

  • Objects that are created in microflows that contain the Generate PDF from page action are not available to use in your PDF document. This is also applicable for changes made to existing objects. The reason is that those changes are not persisted to the database until the whole microflow has finished. The document generation service will access your document in its own context, and therefore have no access to the non-persisted changes.

 

A potential workaround is to the EndTransaction action from Community Commons module, although it is important to realize the effects of using this action is that it prevents rollbacks of the actions before the EndTransaction.

answered
-1

Hi Natalie,

From what I can see it should work. The only thing I can think of is about access rights. Could you check if the user has write access to those attributes? 

answered