I’m trying to edit an Option set using the maintenance app by selecting the edit option. The option set fails to load but gives me the below error:
“Can not add a model without id to a ModelCollection”
I’m on Version 2.39.1. Any suggestion on how I can sort this out?
Hello @Mukaha if you are facing that challenge to the option set, some of the option value in the database has not been linked to the option set id in the table optionvalue
So to solve it, you might need to interact with the back-end database and find those option that has not optionsetid and clean them.
Thank you @tuzoengelbert allow me to work on this. I will revert in case I encounter a challenge.
Having the same issue. Thank you for your response @tuzoengelbert. Is doing this through the back end the only approach? We were only attempting a change in the name of an option set, not creating anything new. I am on version 2.39.3 and wondering if this was related to a bug.
Hello @MELB Do you still get the challenge on this ?
Hi, @tuzoengelbert my problem still exists as I don’t have backend experience. Is there any way to address the challenge? Or do you have a guide on how to access the backend to fix it?
we had to implement a fix on the back end to address the issue. I have yet to test again to see if the issue persists. I do not have the details on what the fix was. We work with a consultant. I have not tried changing an option again and hesitant to do so in case this issue persists.
I hope @tuzoengelbert and @MELB will be able to help you out. I have a suggestion if you would like to try it out please.
Using the Import / Export app, export Option Set metadata (as JSON and not compressed), and then when the JSON file has been download. Perform a dry run import:
- Metadata Import, upload file and select JSON
- Import report mode: “Full - Reports for all objects imported”
- Import strategy: “Merge - Import new values and update existing”
- Atomic mode: Import
- Merge mode: Replace
- Flush mode: Object (debugging purposes)
- Async: Asynchronous import
- Inclusion strategy: Always
Start dry run
Please check the error log? If it’s all working great, please test in a testing instance use delete and then import again.
First, I will share you the query to check if there is optionvalue that has not been assigned to optionSet
Go to Maintenance => Others =>SQL view
- Create SQL View with type view
Type the query
select * from optionvalue where optionsetid is null;
Then let us know if it brings value
Hi @Gassim, thank you for sharing this option. I have tried it on a test environment and it has worked! Many thanks.
Allow me to try it on the dev instance, but before I try this. What would be the implication to existing data?
Yes, please test on a test instance which has the data as well so that you could check if the data is affected. If the data is affected you will need to export it and then after you fix the metadata issue with the above step, import the data again and see if everything is back to normal.
Sorry I couldn’t think of an easier/better way.
Good luck! (:
I tried the solution on the live instance and I am happy to confirm that the error is now gone, and the existing data wasn’t affected.
Many thanks to you and @tuzoengelbert for your support on this matter.
Looks like the issue has been resolved.
Glad you were able to resolve on your end @Mukaha
Thank you for spending time testing and confirming the solution. So glad that it worked.
Thanks @MELB for sharing this link. It never hurts to have more than one way to solve this issue.