I have stepped through and debugged my code and the id that is being passed to the GetItem() method is the ID of the training plan I am looking to get and the custom table class name is correct (It is getting the correct custom table. However the returned item is the first item in the custom table (I've looked in the database) not the item with the ID that was entered.
int id = parameter.ID; CustomTableItemProvider provider = new CustomTableItemProvider(CMSContext.CurrentUser); entity = provider.GetItem(id, TrainingPlanConstants.TrainingPlanTableName);
This unrelated custom table item is returned no matter what integer value is input. I have done a work around by using the GetItems() method - but this is not ideal as I know which CustomTableItem I want and this workaround is an unnecessary loop.
Hi Simon, Look at the same kind of question on stackoverflow: CustomTableItemProvider.GetItem() Is returning the wrong item
If this doesn't help you please let us know.
Try using CustomTableItemProvider.GetItems(classname, where, orderby, topN, columns)
Please, sign in to be able to submit a new answer.