Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Content Type not being updated from code

Vote:
 

Hi,
I have an issue where a content type is not being reverted to code after choosing 'revert to default' from the ct settings in admin. It only increments the version number after saving it via the UI.

I have looked at this thread that states that if another developer manually updates the same property on the same database/CMS then EPiServer ignores your changes. Does this mean that even if you 'revert to default' and click save to commit that synchronization to the DB, EPiServer ignores your changes? I have previously tried to set 

enableModelSyncCommit="false"

to perform a manual sync in admin section, without success.

I don't really see how I can force the database to update to reflect the changes in the model. I'm using v11.15.

#257114
Jun 25, 2021 10:56
Vote:
 

Hi George,

Try the first solution given on below blog post-

https://world.episerver.com/blogs/ollie-philpott/dates/2019/2/common-errors-when-developing/

#257115
Jun 25, 2021 11:17
George Duncan - Jun 25, 2021 12:10
Hi,
I don't think scripting directly against the database is an acceptable solution. It certainly cannot be an officially sanctioned one.

At any rate, I cannot replicate the error message relating to that blog posts' issue for the offending content type, so attempting this isn't really an option here.

Any other solutions? For the record, I have updated content types many times before from code on this solution without issue.
Vote:
 

So, I went and tried the quasi-solution at 

https://world.episerver.com/blogs/ollie-philpott/dates/2019/2/common-errors-when-developing/

Anyway, I backed up my dev database and amended the script to

UPDATE [dbo].[tblContentType]
SET [Version] = REPLACE(Version, '4.2.0.0', '1.0.0.0')
WHERE [Name] = 'ImageFile' AND [Version] = '4.2.0.0'

and the content type in the backend changed back to 1.0.0.0. Great, right? 

Wrong. The content type still does not pick up the new field from code, and i'm looking at the possibility of having to write my own scheduled job to update the offending content type using the repository.

#257250
Edited, Jun 28, 2021 13:43
Vote:
 

Is the version is correct now? and the yellow warning on the content type is gone?

if yes then please try to reset your IIS and rebuild the solution and publish it again.

#257251
Jun 28, 2021 13:49
Vote:
 

The version is correct, but the new field hasn't been added from code, even after an IIS reset and rebuild/republish. There was never any yellow warning to begin with on the content type, nor any error relating to this in the log.

#257255
Jun 28, 2021 14:27
Vote:
 

It turns out this was some as-yet-unidentified build problem. I had another developer deploy from a newer build on the same CMS version and the issue was resolved.

#258925
Jul 14, 2021 15:45
Vote:
 

I believe I'm having the same issue as this with a field name and started a thread before I saw this.  Here is the link with screenshots.

https://world.optimizely.com/forum/developer-forum/CMS/Thread-Container/2021/8/unable-to-update-field-name-of-block-via-code-or-ui/

#260091
Aug 04, 2021 21:07
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.