I resolved my issue, a ran a getData()
Bahahah I completely missed that!
I have tried your latest suggested method to auto-assign almost any ID. This is great, thank you. I am having an issue though when the user clicks on “Save” but forgot to fill a required field. I believe that “AutoAssign” case and GetNextSequence method are triggered (preprocessing) before the popup error (example: customer TermsCode was not selected). The sequence is incremented as many times as there is an error while saving.
Anyone found a way to avoid this?
Steps to reproduce :
- AutoSet the next customer to 1000;
- Fill required fields except TermsCode;
- Save (an error will be displayed);
- Select a TermsCode;
- Save. The customer ID will be 1001 instead of 1000.
No real way to avoid this, and that’s generally ok in my opinion there is’nt any REAL reason why the numbers should be actually sequential
There is no great significance to 1001 1002 vs 1001 , 1012 they both accomplish the same thing.
The only way around it would be to assign the ID after all the logic runs which is not possible since the ID is a required field itself.
Unless you set it to some random unique string first, do the work, look for the next available then reset it since it can be changed after the fact. But generally, the sequence number was the protection used for manual supplier creation outside of systems. It seems to get pulled into automated systems even though security should take care of the same issue.
My logic “tries” to assign at the last minute, but if there is a problem during the save, AND THEN the user aborts the add, it will “burn” a customer ID… as long as they fix the problem and resave, it should not have this problem because I don’t calculate the number until Save.
Correct me if I am wrong. The Preprocessing BPM on Customer Update which calls GetNextSequence(…) is executed before the required fields validation (Epicor BaseProcessing is it?). If the user fixes the problem and then tries to save again, GetNextSequence(…) method is called one more time and a customer ID will be “burned”.
Yes, it is called, but only if the current customerID = “AutoAssign”… once it is assigned, the word “AutoAssign” is replaced with the newly calculate customer ID, and will not happen a second time.
You are right. I just don’t understand why in practice, the sequence is being incremented anyway. I added a PublishInfoMessage to the custom code before the switch case, but it is only being displayed when there is no required field error.
InfoBoxes don’t show up if there is an error that’s just “the way it works” unfortunatelly.
Good to know! Then does it mean that MyCust.CustID is not being changed from “AutoAssign” to the next sequence when there is an error? When pressing save again, the “foreach” retrieves the var MyCust with ID = “AutoAssign”.
Correct if there is an error all changes are “aborted” and it resets back generally speaking.
Hello Jose, I m pretty new to Epicor 10,
I saw your youtube video about Auto Sequence Customer Id, and was able to copy that idea and make to work on ShitoNum.
Is there a way to make that ShiptoNum sequence by customer.
and if I want to Add a new Shipto for Customer B , it should again start from 001.
Thanks in advance.