Support Article
Action is not allowed as it is outside the current transaction
SA-14848
Summary
Transaction errors occur throughout the application. There seems to be no pattern. Sometimes an error message appears on the screen, other times only a "transaction id mismatch" error appears in the PegaRULES log file with Pega 7.1.7.
Error Messages
This action is not allowed as it is outside the current transaction
Steps to Reproduce
1. Perform an action on one field which automatically refreshes other fields.
2. Click on the "submit" button or the Enter key if it is tied to submit.
Root Cause
The action performed by the user causes multiple asynchronous UI requests to be sent to the server. Along with the other requests is a FinishAssignment which is associated with the Submit action.
If these actions get processed by the Server so that the FinishAssignment is processed before any of the other actions (which resulted in a POST request), then these later actions is using a stale pzTransactionID. FinishAssignment transitioned the server to a new pzTransactionID. They fail with the observed error message.
Resolution
Pega uses an Action List to force serialization of the various UI requests to the server. This list mechanism forces one action to complete before allowing the next action to begin.
A submit button built before Pega 7 is not using the Action Queue to send the FinishAssignment request. This allows for the various actions to get out of sequence.
Switching to a Pega 7 button (see pyCaseActionAreaButtons as the preferred set of buttons) allows the FinishAssignment to process through the Action List. These buttons are already configured to use the Action List:
If custom buttons are required, ensure that they utilize the Action List to process their action if it involves a FinishAssignment.
In addition to this change, there is a possibility that on a slow system, double-clicks of the submit button (or Enter key) can issue a double call to FinishAssignment.
As this also causes error, the following script added to userworkform disables the Submit button while Finish Assignment is being processed:
<script>
pega.u.d.attachOnload(function(){
var formSubmit = pega.u.d.submit;
var submitted = false;
pega.u.d.submit = function(strAction, objButton, strBusyText, event){
if(submitted) return;
if(formSubmit.call(pega.u.d,strAction, objButton, strBusyText, event)) {
submitted = true;
}
}
},false);
</script>
Finally, if firing a script from within an Action List associated with an action, the script might be making an Ajax call by means of the old-style API shown commented out below.
Eliminate use of the API (commented out) and use the newer API shown below it -- this one uses the Action List:
// pega.util.Connect.asyncRequest('POST', safeUrl.toURL(),specialActivityCallback);
pega.u.d.asyncRequest('POST', safeUrl,specialActivityCallback);
pega.u.d.asyncRequest('POST', safeUrl,specialActivityCallback);
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.