Support Article
Transaction ID mismatch error occurs on clicking button twice
Summary
On the Pega application, error occurs on clicking the out-of-the-box Custom buttons more than once.
Error Messages
Action is not allowed as it is outside of current transaction.
Steps to Reproduce
Configure a button to navigate to the next screen or step.
Root Cause
An issue in the custom application code or rules.
When the button is clicked, the next screen takes time to load. If the button is clicked twice, the request is sent twice to the server. For each request, a new transaction ID is generated. When the server is invoked with the new transaction ID, error occurred since the server expected the previous ID.
Resolution
Perform either of the the following local-changes:To prevent the user from clicking the button twice, implement the Busy Indicator or disable the button after the first click.
- Implement the Busy Indicator as below:
- Configure the first action as a Run script.
- Invoke the setBusyIndicatorCustom function according to the below code on the button.
<script>
function setBusyIndicatorCustom(){
pega.u.d.busyIndInterval = 110;
pega.u.d.setBusyIndicator();
}
function resetBusyIndicatorCustom(){
pega.u.d.busyIndInterval = 2000;
if(pega.u.d.gBusyInd){
pega.u.d.gBusyInd.hide();
}
}
</script>
- Configure the last action on the button as a Run script with the resetBusyIndicatorCustom function.
- Perform the below steps to disable the button after the first click:
- Create a non-auto generated section.
- Include the below code in the section.
<script>
function disableBtn(){
$(".btnSendEmail").onClick(function(){
$(".btnSendEmail").prop('disabled',true);
});
}
</script> - Include the non-auto generated section in the section where the button is present.
- Open the Button configuration.
- Click the Presentation tab.
- In the Cell read-write classes, include btnSendEmail.
Tags:
Published April 14, 2020 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.