Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
I can see that there is a small error in my copy-paste from my code to this post.
I am saving the page for publish so the Save code should look like this:
DataFactory.Instance.Save(newClonedPage, SaveAction.Publish, AccessLevel.Create);
Not sure if it makes any different though...
Hi,
I'm getting error when trying to save a page.
I create a new page programmatically and save it. I then populate its children through copying some other pages in my solution. Depending on of the copied children I want to update a property in my page. All of this is happening in the same function and I've not navigated to my new page yet, and I still only have a PageReference to my new page which is returned from when I saved it.What I want to do is this:
foreach (PageData page in children)
{
if (page.PageTypeID == kindergardenPageTypeId)
{
PageData newClonedPage = GetPage(newPage).CreateWritableClone();
newClonedPage.Property["myProperty"].Value = page.PageLink;
DataFactory.Instance.Save(newClonedPage, SaveAction.Save, AccessLevel.Create);
}
}
It compiles fine but in runtime I get this error message ont the DataFactory.Instance.Save function:
The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPageType". The conflict occurred in database "dbPBL", table "dbo.tblPageType", column 'pkID'
A thing that I noticed is that the pagereference to my new page look like the page id combined with a working page id, ex. {500_888}. Is there some delay interval from when you create your page until you can alter it? Anyone seen this error before?
- Kjetil Simensen