Cancel changes on form / Disabling the "Save Changes?" Dialog

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
andreic
Posts: 29
Joined: Mon Nov 15, 2021 11:09 pm

Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by andreic »

Hi everyone,
I'm relatively new to AwareIM, working on an application for our institute, and encountered a situation with simple cancelling of work on forms:

I need a way to provide a simple "Cancel" button to the user that closes the form and discards any changes done without asking questions.

I can't seem to get this done because:

1. A button of type "Close Form" in the panel operations of the form always shows the "Save Changes?" dialog box, which includes a "Yes" button so that's not ok.

2. If that same button has the option to execute a process after closure, the "Yes" option doesn't actually save the form anymore (a bug?), which is misleading so not ok also. I thought I'm supposed to capture the "Yes" in that process with Question.Reply but that doesn't do anything either.

3. If the button is instead of type "Start Process" and the process calls EXEC_SCRIPT 'AwareApp.closeComponent(parser.m_widgetInfo,false,false);', the same dialog appears anyway, so that doesn't solve anything.

This function by the way is mentioned in user manual but not included in its appendix D (should be added?)

4. A user can click on a menu item outside of the form to discard all changes, that works without asking to save changes, but is not a nice solution.
If the same action of that menu item (process to display a visual perspective) is however started from a "cancel" button on the form, the "Save Changes?" dialog appears again...

Is there way to implement a clean "Cancel" button or somehow disable the "Save Changes?" dialog?

Thanks, andrei
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by PointsWell »

andreic wrote: Wed Apr 27, 2022 8:20 pm Hi everyone,
I'm relatively new to AwareIM, working on an application for our institute, and encountered a situation with simple cancelling of work on forms:

I need a way to provide a simple "Cancel" button to the user that closes the form and discards any changes done without asking questions.

I can't seem to get this done because:

1. A button of type "Close Form" in the panel operations of the form always shows the "Save Changes?" dialog box, which includes a "Yes" button so that's not ok.
Typically it is good design to ask "Are you sure?" before discarding users work.
andreic wrote: Wed Apr 27, 2022 8:20 pm 2. If that same button has the option to execute a process after closure, the "Yes" option doesn't actually save the form anymore (a bug?), which is misleading so not ok also. I thought I'm supposed to capture the "Yes" in that process with Question.Reply but that doesn't do anything either.
What are you trying to do after save? If it is related to the BO that you are saving then you are often better to create a business rule to do something like

Code: Select all

IF BO IS NEW THEN x,y,z
Alternatively if it is being done after a change has been made to the BO then a business rule

Code: Select all

IF BO WAS CHANGED THEN x,y,z
You can be more specific and focus down to specific attributes being changed

Code: Select all

IF BO.Attribute WAS CHANGED THEN x,y,z
andreic wrote: Wed Apr 27, 2022 8:20 pm 3. If the button is instead of type "Start Process" and the process calls EXEC_SCRIPT 'AwareApp.closeComponent(parser.m_widgetInfo,false,false);', the same dialog appears anyway, so that doesn't solve anything.
There are limits to the type of buttons that are visible on a new BO (SAVE/CANCEL). Operation buttons only show on BOs after they have been created.
andreic wrote: Wed Apr 27, 2022 8:20 pm This function by the way is mentioned in user manual but not included in its appendix D (should be added?)

4. A user can click on a menu item outside of the form to discard all changes, that works without asking to save changes, but is not a nice solution.
If the same action of that menu item (process to display a visual perspective) is however started from a "cancel" button on the form, the "Save Changes?" dialog appears again...

Is there way to implement a clean "Cancel" button or somehow disable the "Save Changes?" dialog?
andreic
Posts: 29
Joined: Mon Nov 15, 2021 11:09 pm

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by andreic »

Hi PointsWell,
Thanks a lot for the quick reply.

> What are you trying to do after save?
I need to keep track of record saving, so every save operation has to be followed by an update the LastSaved and LastSavedBy attributes, for example.

I can't guarantee that, if the "Save Changes?" dialog offers a "Yes" option that I can't capture and operate on. I guess if that were possible I could live with this dialog.

Otherwise I'd like to disable it and handle any changes myself. That much should be possible, no?

> Alternatively if it is being done after a change has been made to the BO then a business rule
Sure, the process that I define in the "Execute process after closure" does run - but the changes are discarded before that even if the user clicks on "Yes", that's what I meant in point 2 with "a bug?".

So, either way I take it, the same problem is there - the "Yes" option from the "Save Changes?" dialog is either working only without postprocessing or not working if I try to postprocess. Both are conditions I can't work with.

Cheers, andrei
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by PointsWell »

The process after SAVE feature is not the one you need. You can manage BO Audit logs more easily.

On the BO being tracked create a business rule

Code: Select all

IF BO WAS CHANGED THEN 
BO.LastEditTime=CURRENT_TIMESTAMP
BO.LastEditor=LoggedInRegularUser
You can cut and paste the business rule to all of the BOs that you want to use it on and you will be prompted to change the name of the BO to the one that you are pasting to.

This will better handle what you are trying to achieve as it applies every time that the BO is updated regardless of how it gets changed (eg if it gets changed as the result of a process touching it as opposed to a user interacting with a form)

If you want to get fancy you can capture all of the changes that have been made to the record GET_CHANGES see page 434 of the rules guide document

You won't be able to change the CLOSE WINDOW behaviour to ignore the fact that the BO has been modified without some extreme voodoo.
andreic
Posts: 29
Joined: Mon Nov 15, 2021 11:09 pm

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by andreic »

Hi PointsWell,
I changed my approach to use a rule that updates the BO instead of a process, and that does seem to be a bit more straightforward, great idea!

GET_CHANGES looks very interesting, I'll check it out.

Thanks for your help!
andrei
andreic
Posts: 29
Joined: Mon Nov 15, 2021 11:09 pm

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by andreic »

Follow-up question..

"If BO WAS CHANGED" does not seem to catch changes to reference attributes (if an item is added or removed from the list).

Is there a way to catch those changes as well?

Thanks, andrei
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by PointsWell »

andreic wrote: Fri Apr 29, 2022 7:36 am
"If BO WAS CHANGED" does not seem to catch changes to reference attributes (if an item is added or removed from the list).

Is there a way to catch those changes as well?

Thanks, andrei

Code: Select all

IF ReferencedBO WAS ADDED TO  BO.pmReference
OR ReferencedBO WAS REMOVED FROM BO.pmReference
I’m away from my desk at the moment so check the syntax in the reference manuals if the syntax is off.
andreic
Posts: 29
Joined: Mon Nov 15, 2021 11:09 pm

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by andreic »

Alright, so WAS CHANGED / WAS ADDED TO / WAS REMOVED FROM must be used directly on the reference attribute to catch these changes?

Then this formulation in the User Manual:

The WAS CHANGED Expression can also be used to check if any attribute of the object has changed

may need to be corrected..

Cheers, andrei
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by PointsWell »

WAS CHANGED should pick up changes to the reference attributes so it’s not must use ADDED TO / REMOVED FROM.

Check the log to see what is happening.

Without knowing what your app is doing or how the rules are set up it’s difficult to diagnose why it doesn’t appear to be working.
andreic
Posts: 29
Joined: Mon Nov 15, 2021 11:09 pm

Re: Cancel changes on form / Disabling the "Save Changes?" Dialog

Post by andreic »

From looking at the log I can say that when only the 'If BO WAS CHANGED' rule is present and only the reference attribute is changed, this rule is not executed. The log includes the "Starting execution of rules when updating business object ..." and then nothing.

On the other hand, when there is another dedicated 'If BO.REF WAS CHANGED' rule, it is executed. The log then clearly includes the evaluation of that rule and even says "Condition evaluated to true" and then proceeds to do add the actions to the agenda.

In both cases setting the rule to dynamic doesn't affect this behavior.

andrei
Post Reply