Page 1 of 1

5.1 Classic GetNextNumber

Posted: October 20th, 2022, 9:46 am
by shalomsims
Ran into an issue while converting from 5.1 Classic to MVC with the GetNextNumber service.

I have a loop ForEachItem that iterates over a list of items and updates which items are in the cart.


ForEachItem Loop with child GetNextNumber service
ForEachItem Loop with child GetNextNumber service


The GetNextNumber service that was being called was throwing this error.


Primary Key Constraint Error
Primary Key Constraint Error
GetNextNumber Service incrementing on wrong next available PK for EC_Item_Usage
GetNextNumber Service incrementing on wrong next available PK for EC_Item_Usage

The PK contraint violation started on ITU-10011064 and every time I tried it again it would increment to the next number instead of the next available number. So, to fix it I went to the db and found the next available number myself and used that as the starting Value. Then I changed it back to the standard StartFrom 10010000.
Found and manually changed next available number
Found and manually changed next available number

That seems to have solved the issue but I am not sure why it happened.