Skip to Content
Former Member
Jan 17, 2005 at 04:20 PM

Get last ID of objects


Hi all,

I'd like to know if there is a way to get the ID given to the object saved.

For example, if I save a new Employee, I'd like to get its EmployeeID number.

After I add it (MyEmployeeInfoObject.add) the value MyEmployeeInfoObject.EmployeeID = 0, and not the ID given by Business One.

I know I can find it it the ONNM table, but I can't be sure the EmployeeID retrieve from this table is the one used to add the employee as an other user can add an employee at the same time. I also know that I have to remove 1 to this number because it's the next one available.

That problem is not only for the EmployeeInfo object...

Is there a SQL Server like function "SELECT @@IDENTITY"

Thanks for your help.