Auto Numbering - Customer ID

I was able to get the customer ID to work, but noticed through my testing the other day that the BPM bleeds through to my multiple companies. I am hoping to have them start with a different number in each company. Any chance someone can guide me through the process to have the BPM recognize the different companies?

I was able to get the customer ID to work, but noticed through my testing the other day that the BPM bleeds through to my multiple companies. I am hoping to have them start with a different number in each company. Any chance someone can guide me through the process to have the BPM recognize the different companies?

simply create a different place to store the value for each companyID would be one way.

Hi Tim,

I wonder if I did something wrong. I put the BPMs on each company as company specific, but for some reason the number I did the AutoSet on last; is the number that shows up for each company.

I attached some screen shots.

I am available for a quick chat today if needed.

Thanks again for the help. Greatly appreciated.

Cyle

AutoAssignScreenShots.docx (345.5 KB)

If you want a Company Specific Counter you need to use this instead. There is a global sequence and company specific sequence library

Bring in Reference
Erp.Internal.Lib.Shared

using (var libCompanySequence = new Erp.Internal.Lib.CompanySequence(Db))
{
           var nextCustID= libCompanySequence.GetNextCompanySequence(Session.CompanyID, "CustIDSeq").ToString();
}
2 Likes

Hi Jose,

I placed the code in the using in references for both companies image

The results are below and it still is pulling in the customerID of the second ā€œautosetā€ process. Perhaps I put the code in the wrong place.

Thoughts?

Note: I am in the public cloud environment.
Thanks,
Cyle

@Schneider the code should go in the same place you put the prior codeā€¦ (not in the using statement box)
Also the code I gave you was an example of how to use it it wasnā€™t meant to be directly copied and pasted.

Youā€™ll need to replace my variables with yours.

What does your code look like before this?

@josecgomez

Sorry. I am very new at this BPM stuff. I am currently working on it as we speak. This is what the original code looks like.

Great! so replace the sections using the NextSequence with the new one I gave you.

I found that this was not always helpful as sometimes people would create a new customer by inadvertently click on the new button and then it would increment that number as used. We created a BAQ that is highest
CUSTID used and then we know the next one to use itā€™s added to the BAQ Search with a 1_ to keep it at the top so that itā€™s always easy to find/use.
image

For instance, the highest used is 8332, so the next customer ID should be 8333, however, clicking new created 8434 for me if that helps illustrate the number of ā€œmisfiresā€ on New customer, when you undo it and if you hit new again it would try to create 8435. Hence why we use the BAQ to see the last number used.

Good luck with whatever method you choose!

Iā€™ve seen companies implement something similar before. I always warn them that if there is more than 1 employee who can create the master record, there is a chance that 2 employees might unknowingly select the same number to create their next record. While very unlikely, it can happen. Epicor is pretty good that there would not be any major issues, just some lost time.

@josecgomez

Thanks for the information. Unfortunately, I am struggling with understanding where to put this into the code. I am very knew at the csharpe game and not an IT person by trade.

I have a Post-Processing BPM which assigns the ā€œAutoAssignā€ in GetNewCustomer. Image below. I am trying to overlay your suggestions in ā€œCustomer.Updateā€ as a Pre-processing BPM, which is where I am struggling on how to get it to work.

Any advice on how to get it to work?

Post-Processing BPM Screen Shot

I have the references to ā€œIce.Adapters.UserCodesā€ and ā€œIce.Contracts.BO.Usercodesā€ and still not able to get to the UserCodesAdapter type. What am I doing wrong?

image

What do you mean you cannot ā€œget toā€ it?

Ice.Adapters.UserCodesAdapter myAdapter = new Ice.Adapters.UserCodesAdapter(oTrans);
myAdapter.BOConnect();

Should work, you may have to close and re-launch the form after adding the reference.

1 Like

Also, if you are trying to access that adapter that already exists on a particular screen, it will be a little different. However, Joseā€™s code will instatiate the heck out of that adapter.

Yes, thank you. it kept gibing me an error until i restarted the form

I am getting a null reference exception am I doing something wrong?

You are using FirstOrDefault. That means if it doesnt find a matching record, you get a null. Since you arent doing a null check, thats probably the issue.

replace your message box with this

if(codes == null) MessageBox.Show("I got no data"); 
else MessageBox.Show(codes["Sequence_c"].ToString());

Also, beware the difference between CodeID and CodeTypeID

Also you arenā€™t running a getrows so you have no data to work with
You need to do a GetRows to get the data into the adapter

I am trying to do something similar to your code above