Try our conversational search powered by Generative AI!

Programmatically creating/deleting/editing pages

Vote:
 

We are using a scheduled job to programmatically create pages of a certain pagetype in several languages. All texts that will be imported are stored in a database. We have a timestamp on the pagetype which we update when the page has been updated. The date is also stored in the database. So when we have updated a product in the database and want the corresponding page to be updated in episerver we update the date and run the scheduled job. The master language branch on this site is "en". The problem we have is that if we update the data in the database of some other language branch, for example "sv-se" it seems like when it gets imported some properties (not all!) the value will fallback to the master language branch even though it does have a value in that language we tried to update (in the database). It would be easier to investigate if it happened to all the properties, but since it is pretty random it's not.

We created this scheduled job when the site were using cms 6 so the problem came when we upgraded to version 7.

Have anyone experienced this or similar to this?

 

#82935
Mar 21, 2014 14:32
Vote:
 

I just finished debugging the job and verified that it is the correct values that are being retrieved from the database. But as described above, it ignores the value and it takes the value from the master language branch on the page.

#82994
Mar 24, 2014 12:56
Vote:
 

Hi, If you haven't already checked, you probably need to make sure that the language branch of the current context has been set properly. Check what the HTTP request is in your scheduled job via logging to find out what is going wrong.

This snippet should do the job:

EPiServer.BaseLibrary.Context.Current["EPiServer:ContentLanguage"] = new CultureInfo("sv-se");

    

/Leif

 

#83052
Mar 25, 2014 11:09
Vote:
 

That did not help at all. We did not have this problem in episerver 6. We are getting the correct page and language version of the page we want to edit.

#83149
Mar 26, 2014 14:53
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.