Auto-Increment Primary Key on UD100 New Row?

I’m not a programmer, so I’m hoping someone can easily tell me how to do this. I’m imagining it isn’t too involved to do.

I have created a customized form that runs off of UD100.

When a user clicks to add a new row, I’d like the primary key to automatically fill with the next available number.

I’ve tried to do this through wizards in Customization, and through a BPM but I’m just not smart enough.

We’re running Epicor 10.1.400.24.

Thanks for your input.

Steven

There is currently no way to do this without writing custom code. I hear they are trying to incorporate AutoIncrement keys in later versions but not something that is available right this second. So without writing code you are out of luck I am afraid :frowning:

Hi Steve,

I don’t recommend you to assign the next id when you get a new record because it could be that another user also gets the same next id if he is on this program at the same time. So, instead of adding your NextID logic on a Post Directive on Ice.UD100.GetNewUD100 method, you better do it on a Pre Directive on Ice.UD100.Update. That will reduce the rist of duplicate key.

I don’t have an epicor 10 where do build an example, but what you have to implement should be something like:

On the UI customization
0. disable Key1
On the BPM Pre UD100.Update

  1. get added record on temporary table ttUD100
  2. get last record on physical table UD100
  3. if no record found assign ttUD100.Key1 = “1”;
  4. if there is a record then assign ttUD100.Key1 = (System.Convert.ToInt32(UD100.Key1) + 1).ToString();

Something like that should do the trick…

Hope it helps.

Carlos
PSE