GetaNewUD... vs GetnewUD... what's the difference

Just a simple one here, but what is the difference between GetaNew methods and GetNew methods on UD tables?

Cheers

I faced this quandary when I tried using tables UD100 and UD100A. I struggled with creating the child record, using getnew, until I was pointed to Getanew by an Epicor developer, which worked like a charm. I was told that getnew ā€œis not supportedā€.

I donā€™t know why this is the case, or whether it is limited to UD tables, but since its a familiar topic, I thought Iā€™d share my two cents in the hope that it helps.

Andrew

My take is this is just like an obsolete field. They make it obsolete, but they donā€™t remove it as some installations may still be using it. The GetNew has been obsolete for a long time, you should not use it. Always use the GetANew method.

Kevin Simon

Thanks for the replies everyone. I am glad I asked it. The reason I asked is when I did an info message for both the get new and the getanew methods I only got one for the getanew.

Now we all know.

Thanks

1 Like

GetNew is deprecated, use GetaNew

2 Likes

One of the things I have seen with behavior of getanew is the fact that on UD tables if you attempt to getanew for a record that already exists with the key it just keeps processing and skips inserting with no error. I tried this with consuming a csv into the UD08 table. I can consume the same file as many times as I like and it does not add any new records, apart from the first run. I am not sure if it would update. I have not tried that. Based on my findings it appears you donā€™t need to perform a getanew then an updateext to insert a record with Service Connect, just do a getanew. Service Connect Experts feel free to chip in here.

In my opinion only, you can find a great many holes, loops, work arounds, and hidden nuggets inside the BOā€™s with service connect, but eventually it will unravel at some point. When a call is made in the trace you did, best practice is to put it in (there are a few notable exceptions). Certainly an update is something i would never recommend skipping if you see it called in a trace even though it ā€˜saved the recordā€™.

Rob,
I agree there. To be honest I did not do a trace on adding a new row to ud08 so I will definitely take a look at that.

The thing that worried me was the fact that the method somehow manages to ignore the referential integrity of the database, which was surprising to say the least. Either that or I am doing it wrong and most likely the latter.

Thanks for your reminder on the trace. That is a tip well remembered.