Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Change MetaClass of CatalogEntry Object Programmatically

Vote:
 

Hello,

I need to convert my CatalogEntry object from Metaclass A to B. I can do this in CommerceManager but couldn't find any way to do this programmatically. I need to do this without creating a new CatalogEntry. What would be the best way to do this? Or is there any other way to do this in Commerce 14.7.1.0 that could also help? Thank you.

#306896
Aug 16, 2023 14:40
Vote:
 

Unfortunately changing the metaclass is a not very well thought feature in Commerce Manager and it can cause unforseenable consequences. If you still want to proceed, in theory you can change the MetaClassId of an EntryContentBase (or NodeContent).

I recall that the catalog content system explicitly check to refuse changes in MetaClassId, but I can't seem to find that check in code now. Maybe I remember it incorrectly, or it was removed at some point. 

#306945
Aug 17, 2023 6:23
abdulkadir.erkmen - Aug 17, 2023 12:24
with following Commerce Manager changes in database I created a similar sql script, if I change data, remove old meta properties and add new meta properties would it work?
Vote:
 

Hi Quan,

Thank you for your reply. I actually try to change the MetaClassId of an EntryContentBase but it didn't work, it stays as the old MetaClass even after the update. Probably like you said there is a discarding MetaClass changes flow. I will move forward with other options, then thank you.

#306951
Aug 17, 2023 7:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.