Discussion

1914
Views
Murthy.1303 Member since 2015 12 posts
Capgemini
Posted: May 11, 2018
Last activity: May 23, 2018

This action is not allowed as it is outside the current transaction. Readonly Popup actions.

Scenario:
We have a set of cases tagged together, where users were entering huge volumes of text.
Users want the ability to save draft versions during the case life cycle and want to ability to access and view saved versions in a popup.
There is a navigation in the popup, where users would like to navigate between set of cases that were tagged.
Issue:
Since we are launching popup, user is free to perform any action in parent window, including save or submit.
Once commit action is performed in parent window, and user is trying navigate in child window, user is seeing error "This action is not allowed as it is outside the current transaction."
Background on pzTransactionId property and how PRPC uses it -
  1. PRPC maintains a Transaction ID for every POST Request and validate whether request is valid or not.
  2. Transaction ID can be located @pxRequestor.pxClientExchange .
  3. When a window is loaded, there are few property available at window level pega.u.d.url and document.forms[0].action which contains this parameter transaction id.
  4. Whenever Browser / Client sends an post request, it contains pzTransactionId parameter. PRPC validates client pzTransactionId value with Server pzTransactionId value. If both are different PRPC throws error message something like "posted transaction id '<Client value>921a0b589d6e18558407416a5182b15c' for frame 'pyWorkPage' DOES NOT match record '<Server value>'"
  5. After POST request response, PRPC sends the updated pzTransactionId value to client, so that it would become pzTransactionId value for next request.
Root cause:
When save or commit operation is performed from parent window, which effected the transaction id, parent window is refreshed to capture new transaction id value, but not the popup window.
Hence subsequent call from popup window, which still has the old transaction id lead to "This action is not allowed as it is outside the current transaction."
Resolution:
Place the below script in userworkform or in JS file and make it available to window in question.
For every click on popup window I configured to call below handleDraftPopupStaleTransactionIssue function as first action. (Note: this has to be a first action)
function handleDraftPopupStaleTransactionIssue(){
	var newurl = SafeURL_createFromURL(pega.u.d.url);
	newurl.put('pzFromFrame','');
	pega.u.d.url = newurl.toURL(); 
	var url = document.forms[0].action; 
	var formURL = SafeURL_createFromURL(url); 
	formURL.put('pzFromFrame',''); 
	document.forms[0].action= formURL.toURL();
}

In my case, no write actions are allowed from popup window, hence I am calling this script only from popup window.

You need to call this script this function as first action, where ever you expect to see stale transaction.
User Interface Developer Knowledge Share
Share this page LinkedIn