Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Is it possible to cancel a save on currentcontact?

Hi!

Let us say that I want to validate some fieldvalues before the user saves the contact.
And let us say that "since field 'contract' was not filled with information, the contact should not be saved".

Can I cancel the "automatic" save operation when using OnCurrentContactBeforeSave?

(I cannot make the field mandatory, because it is only mandatory if another field is filled first)

Re: Is it possible to cancel a save on currentcontact?

Hi Björn,

This is the oldest, most popular request. Unfortunately its just not possible.

What we've seen people do is display an error message and then reopen the page that contains the validation error to give the user another chance.

Best regards.

Af: Tony Yates 30. jun 2010

Re: Is it possible to cancel a save on currentcontact?

I should probably note that in SuperOffice CRM 7 you will be able to assigned a string to the currents (all entities) "ValidationMessage" property subsequently disabling the Save/OK button altogether. When the user hovers over the button the validation message will be displayed and will not be able to continue until he/she changes input and triggers your script to remove the ValidationMessage.

This functionality basically eliminates almost every likely scenario someone would want to prevent a save in a scripting event.

Best regards.

Af: Tony Yates 1. jul 2010

RE: Is it possible to cancel a save on currentcontact?

Hi!

We are using OnCurrentContactFieldChanged to validate companyno. If the companyno is not valid - we are setting the CurrentContact.ValidationMessage to a value telling the user whats wrong. This disables the OK (save) button.

Problem; if the user do not use the tab key out of the field - but instead push the OK (save) button - we are not able to prevent saving. 

Is there a way of doing this?

(The customer is using version 7.5.5253)

Regards, 

Trine

Af: Trine Ølberg 18. jan 2017

RE: Is it possible to cancel a save on currentcontact?

Never say Never

I have implemented exactly this function: force a Sale to be canceled under specific circumstances

We use SuperOffice Windows v7.5

It is possible using VB scripting inside SuperOffice

Method:

User opens a Sale for editing and a OnSaleEdited event is fired

Run your code to determine if the sale should be canceled or not

If it needs to be canceled, fire a separate VBS script asynchronously which does nothing but cancel the sale.

We have had this in place for over a year and it works very well.

Af: Jochen Siegenthaler 18. jan 2017

RE: Is it possible to cancel a save on currentcontact?

Never say Never

I have implemented exactly this function: force a Sale to be canceled under specific circumstances

We use SuperOffice Windows v7.5

It is possible using VB scripting inside SuperOffice

Method:

User opens a Sale for editing and a OnSaleEdited event is fired

Run your code to determine if the sale should be canceled or not

If it needs to be canceled, fire a separate VBS script asynchronously which does nothing but cancel the sale.

We have had this in place for over a year and it works very well.

Af: Jochen Siegenthaler 18. jan 2017

RE: Is it possible to cancel a save on currentcontact?

This Hole will be plugged in the upcoming 8.1.
Clicking the Save button, does explicitly cause a Focus change so your FieldChanged handler will be called but the Button still assumed it could go on... Now it first tests to see it it is still Enabled.

Sorry about this!
I suppose I spend the better part of my life plugging holes. But the end is nigh :-)
Conrad

Af: Conrad Weyns 19. jan 2017

RE: Is it possible to cancel a save on currentcontact?

Hi!

We are using OnCurrentContactFieldChanged to validate companyno. If the companyno is not valid - we are setting the CurrentContact.ValidationMessage to a value telling the user whats wrong. This disables the OK (save) button.

Problem; if the user do not use the tab key out of the field - but instead push the OK (save) button - we are not able to prevent saving. 

Is there a way of doing this?

(The customer is using version 7.5.5253)

Regards, 

Trine

Af: Trine Ølberg 22. jan 2017

RE: Is it possible to cancel a save on currentcontact?

Run your validation routine on multiple events:

1. When the user opens the Sale: OnEditSaleClicked
2. When the user changes any field (as you have now)

This way the Sale is validated and if it fails validation, the OK button is disabled before the user has clicked anywhere within the Sale.

Af: Jochen Siegenthaler 22. jan 2017

RE: Is it possible to cancel a save on currentcontact?

No, as I mentioned, this is now fixed in the upcoming 8.1.
Conrad

More: I do not have a work-around for this.
As Jochen is on to, you might get some help by attacking it from more than 1 angle.
However, it will still be possible to make the valid number field invalid and hit the Save button directly...
The next step is to hook on to the BeforeSave message and force the field in some known invalid state... I don't think there is a good fool proof solution.
In 8.1, the Save button action will not be dispatched if it got disabled due to the implicit focus change.

/conrad

Af: Conrad Weyns 22. jan 2017