I have created an add-in with visual studio tools. The add-in was created to add extra criteria to validate customer on cash receipts. I want to stop the ability of cash receipts for certain customers. I added a method for ValidateBeforeOriginal for customer field. it stops the adding of the customer and leaves the field highlighted. I have set cancel to true for the ValidateBeforeOriginal. The problem is it also gives a warning that you can't change customers on a document, If you try to change the customer. I've tried LeaveBeforeOriginal. It does not work.
Any ideas! I need to make the window know that the customer is wrong.
You probably need to set the CustomerID to ( see code example below)
void CustomerNumber_ValidateBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
if (rmCashReceiptsWindow.CustomerNumber.Value == "AARONFIT0001")
rmCashReceiptsWindow.CustomerNumber.Value = "";
MessageBox.Show("Invalid customer selected.");
e.Cancel = true;
I've been through this window before working on turning off the feature that keeps the customer id populated for the next receipt so have dug in a bit on the code here. I believe there is also an '(L) Old Customer ID' field that you should also clear when you clear the Customer Number. The code continually compares values in those fields and I'm guessing that is where the warning message is popping from.
Just a shot.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Use the official Twitter tags:
#MSDYNCOMM | #CONV13