Dirty Check modal Save and Discard buttons don't work as expected when Optional flow action launched

Hello All!

We have few optional actions configured for a stage in the case life cycle. When we are in the stage and we have some unsaved changes on the UI (basically dirty flag is set), if we launch any optional flow action, dirty check modal is getting launched to either Discard or Save the changes.

Clicking on Discard is discarding the changes and lunching the optional flow action as expected.
EDIT - clicking Discard is closing the modal and launching the flow action as expected but unsaved changes are getting posted to server.

Clicking on Save button is saving the case and closing the window. User has to pick the case again from work list and perform the same steps. When “Close after Save” check box is unchecked, the case is saved and rendered in Review mode instead of launching the flow action.

Has any one seen this issue before and found a solution ? Or is this a limitation with the platform ?

Disabling dirty check on client side is not an option for us as we still need to show the prompt to the users to save unsaved changes when moving out from the case.

Below are the steps for the Save use case.

  1. Open any assignment which has optional flow actions configured on the stage/case level
  2. Make the UI dirty by adding/deleting data on the screen
  3. Pick any optional action from Actions menu
  4. Dirty popup will be shown either to Discard or Save the changes.
  5. Click Save to Save button.

Desired Result: Case should be saved with changes made on UI and the optional flow action should be launched
Actual Result: With checking or unchecking the save configuration “Close after save”, flow action is not launched after Save.

Below are the steps for the Discard use case.

  1. Open any assignment which has optional flow actions configured on the stage/case level
  2. Make the UI dirty by adding/deleting data on the screen
  3. Pick any optional action from Actions menu
  4. Dirty popup will be shown either to Discard or Save the changes.
  5. Click Discard button to discard unsaved changes.

Desired Result: Unsaved changes should be discarded and the optional flow action should be launched
Actual Result: Flow action is launched properly but unsaved changed are not discarded.

@SanthoshB16725345

Hi, We can always customize dirty popup sections. ‘pyDirtyCheckConfirm’ section ‘Save’ has on-click actions with ‘Save’ for ‘close after save’ selected. Please customize this section and do your changes as intended.

@GopalaKrishnudu_M Thank you for your input. Unchecking the check box ‘close after save’ saves the case and opens the case in review mode instead of closing it. But further actions (in our use case the optional flow action) is not triggered.

User has to do it manually by opening the work object again.

Below are the steps for the use case.

  1. Open any assignment which has optional flow actions configured on the stage/case level

  2. Make the UI dirty by adding/deleting data on the screen

  3. Pick any optional action from Actions menu

  4. Dirty popup will be shown either to Discard or Save the changes.

  5. Click Save to Save button.

Desired Result: Case should be saved with changes made on UI and the optional flow action should be launched
Actual Result: With checking or unchecking the save configuration “Close after save”, flow action is not launched after Save.

@SanthoshB16725345

I’ve looked into the engineering responses to these types of isDirty/ Unsaved changes dialogue functionality. Here is their explanation:

Previous functionality was reported as wrong due to purpose of “Unsaved Changes - “Unsaved Changes - You are about to discard your unsaved changes.”.” pop up, it should always appear before closing the work item or any other window with configuration to set. After clicking on “ok” the window should be closed, it shouldn’t stay as open and proceed with redirection - the pop up in this situation should contain another description (not about discarding unsaved changes).

We are following the global standards, and this is the expected behaviour, enhanced after the Pega upgrade. Engineering decided to change browser pop up into pega pop up to enable possibility of styling and also after closing this pop up work item should be closed, as this is the action that should take place after displaying this message according to accepted standards.

This message “Unsaved Changes - You are about to discard your unsaved changes.” is informing client that his job will not be continued and changes are unsaved. Previously job was still open so this pop up wasn’t needed at all. It works the same way as when we are making some changes inside the word document, and when we want to close the window the similar message appears, if we click “ok” work is closed with no changes applied (unsaved changes).

The solution to avoid this confusion is to include the pxDisbleClientDirtyDetection section along with the table and save the changes.

Also check with the Article below

https://community.pega.com/support/support-articles/dirty-popup-issue-save

The issues with discard and save functionality on pega dirty dialog are known issues in this version of pega. There were lot of implementation changes involved .

As a local change suggested customer to switch to native browser popup by adding below script in user workform. pega.u.d.bUseNativeDirtyConfirm = true

This works as expected but when clients are trying to switch to local action screen multiple times, in the browser popup it also shows a checkbox “Don’t let this page create more messages” or “prevent this page from creating additional dialogs”. If user checks this checkbox user is unable to see browser native popup(confirm box) and also unable to perform other actions because in the code we always receive false value when browser ignores in-page dialogs and we assume that form is still dirty and that is why we are unable to navigate away from current screen.

Please find this confirm box behavior explained here:
Window: confirm() method - Web APIs | MDN

From Pega side we will not be able to completely control the browser showing "“prevent this page from creating additional dialogs” checkbox. We can suggest to update a browsers to the latest version. In latest Chrome “prevent this page from creating additional dialogs” is not being displayed.

The solution to avoid this confusion is to include the pxDisableClientDirtyDetection section along with the table and save the changes.

Further reading:

Configuring confirmation modal dialog boxes

cancelLocalAction(containerItemID)

closeContainerItem(containerItemID, options)

I suggest if you need further help which is not being covered on the forum answers then you may want to log a support incident. Please provide the INC reference if you decide to go down that route.

@MarijeSchillern Thank you very much for the detailed explanation. With your explanation and my further analysis, I understand that the “Save” action on an event will discard/lose all further client actions as it reloads the harness. In our usecase, the subsequent action of launching optional flow action event is lost.

To over come this, as a work around, we have customized the pyDirtyCheckConfirm section and removed “Save” button. Also updated the instructions to “You are about to discard your unsaved changes. To save your changes, close the popup and click Save.”. Thus we are avoiding user leaving the context when using optional actions.

@SanthoshB16725345 I’m glad you managed to get a bit further with your use case.

If you’re happy with the steps you have implemented feel free to click the ‘Accept Solution’ button against the reply which most helped you.

@SanthoshB16725345 thanks for the update.

I double-checked our Resolved Issues list:

Discard functionality in dirty check confirm corrected
Clicking on the Discard functionality in the dirty check confirm on popup closed the item rather than launching the expected work flow. This was traced to gDirtyOverride being returned as false instead of null in the explorerFormIsDirty function. To resolve this, the logic used to for gDirtyOverride on a native alert close for dirty handling has been removed.

This was all fixed from 8.6 onwards.

It sounds like a closer look at the configuration used might be in order. Perhaps there is a commit occurring before the data validation check.

Can you confirm that this isn’t caused by a possible clash with the OOTB browser behaviour as described in Configuring confirmation modal dialog boxes?

A similar forum question was posted here: Can’t close the harness when click cancel after post the value

If you are unable to resolve this feel free to log a support incident via the MSP. Please provide the INC reference here so that we can help track it.

@SanthoshB16725345 I can see that INC-268225 has been closed with the following explanation:

Analysis: Change the Discard button Action to ‘Cancel’ and this does not save the changes as expected, but this also doesn’t go to where in the UI that is expected.
The function on the discard button has been updated in the latest, but also the behavior is still saving instead of discarding.
When comparing this with UI Kit with a Process Flow, the behavior for Discard seems to work correctly.

Attempted solutions / workarounds: Change the Discard button action to ‘Cancel’ and this works to discard the changes, but still doesn’t take the end user to the expected UI location. We also can’t use this for a solution.

Root cause: Product bug (determine whether issue has been addressed in a more recent release)

BUG : DirtyCheck modal Save and Discard buttons don’t work as expected (BUG-800923)

Notes: In the Screenflow case when we made some changes in form level and changing the stage from actions dropdown then dirty poup is coming and on click of discard the changes are retaining hence discard is not happening. As confirmed by engineering this issue will be fixed in a future patch (possibly Pega 8.7.6 Patch Release)

I can see that there have been further discussions but that these are now being looked at under a different support reference ’ INC-273040’. (‘.. to continue on to the other issue of the Save to be investigated’).

Analysis:

Essentially the Save does save the changes, but the UX is confusing since Edit Details screen is not where the end user is taken after clicking Save button on pyDirtyCheckConfirm

Launch case manager, New>Process Flow>click Submit>type some text in the description field>click Actions>click Edit Details>click Save button>observe that you are not directed to being on the Edit Details screen (instead you are on the Dashboard- or somewhere else like Recently visited or the beginning of Assignments ) Not the Edit Details screen.
Now launch the Screen Flow Case type>click Submit>enter some text>click Actions>Select Edit Details, Observe that you might not navigated anywhere, you just stay on the same screen or that you are taken somewhere else on the UI like Recently opened which is confusing UX.

Conclusion:

DirtyCheck modal Save button doesn’t work as expected (BUG-802403)

Target release: Pega 8.7.6

Hi @MarijeSchillern, We were able to provide the workaround for Save issue but we are seeing even “Discard” is not really discarding the changes but posting the unsaved UI changes to server. Analyzing further. Updating the question too with these details

@MarijeSchillern Thank you very much for you detailed explanation and for pointing out to the other resolved issues. We were happy with the above workaround to hide Save button but Discard button is not really discarding the changes in Screenflow. It works fine in Process flow. Raised INC-268225 with Pega GCS.