AI OnAI Off
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.
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
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.
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?