Auto Numbering - Customer ID

Will have to test that out. Thanks!!!

Chris,

I am testing this and see how well it works. When you are calling it, are you calling it within ToolClick for “New”?

In my case, I had it based off the change of another field. Also in my case, it was important that I get the seq without updating until customer saved the record, that way i wouldnt be incrementing if a record wasnt saved.

You can just call it on new.

What dll is Ice.Lib.NextValue in?

This would be in Ice.Lib.NextValue.dll. This is located in your server assemblies folder which will default open when adding a reference.

This is where I would have thought it was, but there is not a dll called this. Ah, it is in just the server assemblies and not client assemblies folder.

Any thoughts on using the Erp.Internal.Lib.Shared.dll and the class Erp.Internal.Lib.CompanySequence.GetNextCompanySeq(company, sequencename)?

From the looks of it, it will create a record in the Erp.CompanySequence table if it’s missing and increment it. I just stumbled across it.

And it also looks like you can manually set it with SetCurrentCompanySequence( company, sequenceName, currentValue) method

Hi Tim,

Working through the documentation, but i am getting an error message on the custom code. Not sure if the attachment will come through, but it is called Code: CS7036 "there is no argument given that corresponds to the required formal parameter ‘newValue’ of Next Value.SetSequenceCurrentValue(IceContext, strin, int)’

I am hoping to get the customer number to begin with 200000 and then auto tick up from there so that the next customer number is 200001

CustomerAutoAssignError.docx (98.6 KB)

Thanks in advance,
Cyle

As you can see SetSequenceCurrentValue is expecting 3 parameters.

Change
NextValue.SetSequenceCurrentValue(NextSequenceCode, NextValueReset)

To
NextValue.SetSequenceCurrentValue(Db, NextSequenceCode, NextValueReset)

1 Like

Hi Jonathan,

Thank you very much. It now works. Greatly appreciated.

When should I set the customer number? We are in the process of converting customers over and I plan on using DMT to populate the initial list.

I was also thinking about removing the “C” from the customer ID. I can simply remove the “C” from the following part of the code…correct? MyCust.CustID = string.Format(“C{0:000000}”"

I tested changing the customer ID to read only through the extended properties table after I created a few. There shouldn’t be any downstream impacts correct?

Thanks,
Cyle

I’m not sure how DMT works, but CustNum is autoincremented as far as I know so maybe just leave it.

Yes, just remove the C from the format.

It should not, as far as I know CustNum is the actual key used for references, the ID is only for display/input and can be changed after.

2 Likes

And same for Supplier IDs. If you want, you can go back and auto-number at anytime.

If you use Intercompany, the customer ID and Supplier ID for trading companies MUST be the company ID.

1 Like

Hey All,

I’ve been working on automating our VendorID’s using the items you all have discussed here. I have it working the way it was intended to. I did make a minor change where instead of the C in front I grab the first letter of the name of the Vendor instead.

What I’m trying to accomplish now is how to get it to recognize when a letter is different from what was used previously. I would like it to behave like the following example:

Vector = V0001, Sharmane = S0001, Vaas = V0002, Sound = S0002.

Has anyone accomplished something similar?

You’d need to have a different sequence for each letter.

So probably just do the same you are doing but whatever sequence code you are using should be dynamic based on the first letter.

Would it be easier to query the existing Vendor ID’s selecting the MAX VendID where the VendID starts with the first letter of the vendors name? Then just take the last 4 char, convert to an integeger and add 1 to it.

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