SalesLogix 7.5.2 Web – Invalid Index X for this OleDBParameterCollection Error

 

I recently ran into an error on an upgraded SalesLogix 7.5.2 web client when attempting to save changes to an entity using the standard entity.Save() method.  The error looked like:

Saving Error

I found that the cause of the problem was that for some business logic reasoning we had been setting an entity property’s relationship ID via code on the result of a lookup control’s change action.  Let me explain that a little better.  The entity ( I will call Widgets) has a relationship to another entity.  That relationship is expressed with a property called Widget.Role.  The entity itself has a property called Widget.RoleId which is the field where the ID is stored that actually creates the relationship to the other entity.  Hopefully that makes sense.

 Now when you use a lookup control, what happens when you perform a lookup to an entity, SalesLogix automatically creates the relationship (Widget.Role) but does not populate the ID field (Widget.RoleId) until after the save event.

 Back to my scenario, we had been using in code calls to Widget.RoleId to get values.  Now this worked fine for existing entities with the relationships established but when inserting a new Widget the RoleId property was empty, even after using the lookup control to populate it.  For this reason we had mistakenly added code to the lookup change event to set Widget.RoleID = Widget.Role.Id.

 I say mistakenly, because this led to the error I mentioned above.  Apparently SalesLogix, when saving a record attempts to identify how many fields have changed on the entity in order to issue the underlying database commands.  By us having manually updated both the Widget.Role (via the lookup) and Widget.RoleID (via the code) the system saw 2 fields having been updated even though it was in fact an update to really only one field.  This caused the creation of the array used by the underlying database update to have an invalid array. 

 We resolved this by changing our code from checking the Widget.RoleId property to checking the SalesLogix generated Widget.Role.Id property and all was back to blissfulness.

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!