Auto increment a UD field on LaborDtl

Yeah, You probably just didn’t wait long enough. It takes a loong time to load those in. Be patient and it will show up.

Ok you were right…my lack of patience killed me ha ha it is there and is now selected…

What if the field isn’t a string? I am getting the error:

BPM006 Result of expression cannot be assigned to variable of ‘System.Int32’ type

Also the UD14 maintence…is that just the UD feild you used? Sorry I feel like a kid on his first day of school here…I really have been using epicor for more than a few days…

Let me play around and see what I can figure out. I’m guessing that the easiest solution is going to be adding a string UD field so that you can use that.

UD14 is a table that I had a rando testing customization on for trying stuff like this. All of the UDtables have a screen that you can use to add/delete change etc. I happened to have added the menu for testing purposes.

So you can convert it to whatever you need to and it still works.

So I set number01 instead of character10 and that gives me the same error you are seeing. So add a convert to that, and it works.

 Convert.ToInt32(new Ice.Lib.NextValue(Db).GetNextSequence("Charatcter10").ToString("10000"))
1 Like

Ok that worked great…no more error code…

As I am working with the LaborDtl_UD table, I am not sure how to get to the second screen that you posted above…I assume that is the screen that will actually allow me to have the number increment?

That would be your customization. Where do you want that to show up? Where is the check box that you made showing up?

ahhh sorry that makes more sense… I saw maintenance and just assumed it was something else to actually change. I might have jumped the gun on the “no error” comment though…it compiles the code fine with the designer but when I exit and save the directive I get the following:

image

Great stuff here! Just wanted to add a few additional notes.

We do an auto sequence as well, but we chose to do it via a UD table and hold different sequence numbers per type of transaction. Example each of our finance groups (AP, AR, Cash, etc.) get an auto sequence number assigned to them. However, we wanted it controlled so we added rows to a UD## table. We use the Key1 field to assign it to the section of the system we want the number. We then pull the value from the UD table in a BPM based on the calling method, increment it by one, and store it into the field/object on the screen and update the value in the UD table to the new value. Then, when it is called again the process just repeats.

Just thought I’d add that for your information in case you do not want what the built in Ice.Lib does for you.

1 Like

That basically what the built in library is doing for you. It’s just in a table that isn’t exposed the BAQ, but it’s in the database if you have access to the SQL DB directly.

1 Like

So the error will go away once there is value written?

I’m checking on that. I’m going to recreate exactly what you are doing (because I never got that error) but I have to regenerate the data model for the extra fields. That takes a little while. I’m guessing you are just missing something.

While I’m waiting, can you paste in your code/screenshots here, so I can take a look at it?

  1. add Assembly reference “Ice.Lib.NextValue”

image

  1. write using Ice.Lib;

image

yeah it won’t actually let me save with the BPM Enabled so not sure how it would get the value


Hi Surendra

I did both of those (well I already had the reference but didn’t have anything in the usings) and still gives me an error when saving

image

hmmm, no error for me. I’m on 10.2.200 though. Maybe a bug that they fixed?

gives me the same error…

can you paste your final code here?

craaaaap you think that could be the problem?

Convert.ToInt32(new Ice.Lib.NextValue(Db).GetNextSequence(“IWRNum”).ToString(“10000”))

Referencing Ice.Lib.NextValue

and using Ice.Lib;