I wanted to set the default button in the Messagebox to be NO but apparently can’t do that. As a workaround I need to override the following:
protected virtual void Customer_CustomerClassID_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
{
Customer row = (Customer)e.Row;
CustomerClass cc = (CustomerClass)PXSelectorAttribute.Select<Customer.customerClassID>(cache, row, e.NewValue);
this.doCopyClassSettings = false;
if (cc != null)
{
this.doCopyClassSettings = true;
if (cache.GetStatus(row) != PXEntryStatus.Inserted)
{
if (BAccount.Ask(Messages.Warning, Messages.CustomerClassChangeWarning, MessageButtons.YesNo) == WebDialogResult.No)
{
this.doCopyClassSettings = false;
}
}
}
}
I have changed the warning message by adding a translation for the warning message as by default we want YES to only change the class ID and nothing else. How do I go about overriding the code to match? I only want to change the if statement to action on WebDialogResult.Yes instead of .No.
I tried just selecting to override the field event handler for fieldverifying, copying and pasting the code in from the source and changing just that line but I get a bunch of errors so I don’t think I’m doing it correctly.
Any advice or pointers to tutorials related to overriding existing event handlers would be very much appreciated.
The errors I get are as follows in case it helps:
\App_RuntimeCode\CustomerMaint.cs(47): error CS1061: 'CustomerMaint_Extension' does not contain a definition for 'doCopyClassSettings' and no accessible extension method 'doCopyClassSettings' accepting a first argument of type 'CustomerMaint_Extension' could be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\CustomerMaint.cs(50): error CS1061: 'CustomerMaint_Extension' does not contain a definition for 'doCopyClassSettings' and no accessible extension method 'doCopyClassSettings' accepting a first argument of type 'CustomerMaint_Extension' could be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\CustomerMaint.cs(53): error CS0117: 'BAccount' does not contain a definition for 'Ask'
\App_RuntimeCode\CustomerMaint.cs(55): error CS1061: 'CustomerMaint_Extension' does not contain a definition for 'doCopyClassSettings' and no accessible extension method 'doCopyClassSettings' accepting a first argument of type 'CustomerMaint_Extension' could be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\CustomerMaint.cs(47): error CS1061: 'CustomerMaint_Extension' does not contain a definition for 'doCopyClassSettings' and no accessible extension method 'doCopyClassSettings' accepting a first argument of type 'CustomerMaint_Extension' could be found (are you missing a using directive or an assembly reference?)
Thanks,
Phil