+ Start a Discussion
Ron WildRon Wild 

Can't update sfLma__License__c seats from Apex

I'm trying to update the number of available seats on an LMA license record (sfLma__License__c) and getting the error


Update failed. First exception on row 0 with id a0770000006dZUZAA2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, sfLma.updateCustomerLicense: execution of BeforeUpdate caused by: System.Exception: Failed to get next element (System Code)


I can edit the number of seats from the License detail page, but not from Apex. 

Does anyone know what's going on in the License manager app that might be preventing the update?







While this post is pretty old, I figured I'd put Appiphony's findings out here too:


We ran into the same issue and resolved it - it is probable that you're trying to update a "Site Wide" license that is actually contained as a "-1" # of seats on the record... We just shifted it to a concrete number of seats, then were able to edit.


LMA code does some unknown things in the background, so we've found that testing all combinations of LMA code goes a great length in knowing what to expect when trying to update Licenses with APEX. Even if a particular combination isn't going to work, it helps that we can communicate that to our customers.