Support Article
Error msg while creating and attaching a pdf to the WO
SA-16902
Summary
Can't useFlow Activity, ‘pyAttachAsPDF’. Errors are showing.
Error Messages
Save, Delete or Commit has failed because lock “<class-name> <Work-ID>” is not held.
Steps to Reproduce
Create a Utility Activity which calls ‘pyAttachAsPDF’ ; reference this Utility from within a Flow.
Root Cause
A defect in Pegasystems’ code or rules.
The ‘pyAttachAsPDF’ Activity calls another Activity called ‘Code-Pega-PDF.AttachToWork’ which contains several Steps which perform either a COMMIT or have the ‘WriteNow’ flag checked.
These Steps interfere with PRPC’s automatic COMMIT handling when running within the context of a Flow.
Resolution
The recommended apporach is to upgrade to the latest Maintenance Release of PRPC7: the Activity ‘Code-Pega-PDF.AttachToWork’ was enhanced to take an extra Parameter called ‘SkipCommit’.
If upgrading is not an option:
It is also possible to make a local copy of the (non-Final) Activity ‘Code-Pega-PDF.AttachToWork’ to add this 'SkipCommit' Parameter and implement the same behaviour (using Pre-Condition When Rules) to skip the Commit Steps.
However: In order to save a copy of 'AttachToWork' , it is necessary to temporarily disable the Validation Rules - as the Designer Studio will not allow a new version of the Rule to be saved (due to a clash in Property Names/Declarative Targets).
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.