CustomTableItemProvider.GetItem() Is returning the wrong item

Simon Budd asked on October 16, 2015 11:59

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.

Recent Answers


Maarten van den Hooven answered on October 16, 2015 12:51

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.

1 votesVote for this answer Mark as a Correct answer

Bill Tran answered on November 16, 2015 20:50

Try using CustomTableItemProvider.GetItems(classname, where, orderby, topN, columns)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.