Content service save and publish raising events and putting me in an infinite loop.
Hi,
I have a page in which I select another page in the site using the multi node treepicker. When I save and publish that first page, I need it to save and publish the other page withthe initial page, so creating a link.
var linkedProduct = node.GetValue("linkedProduct").ToString();
var udi = Udi.Parse(linkedProduct);
var iPublishedContentToUpdate = _umbracoHelper.Content(udi);
var contentToUpdate = contentService.GetById(iPublishedContentToUpdate.Id);
contentToUpdate.SetValue("linkedProduct", node.GetUdi());
contentService.SaveAndPublish(contentToUpdate, "*", -1, false);
That's no problem, except it's raising events and then getting stuck in an infinite loop. The raiseevents = false flag appears to not do anything. I've seen other posts that do indeed say that the raised event flag is redundant, so is there another way I should be approaching this?
I'd be looking to use the relationship service for a feature like this. This would mean that you can update/change the relationship without publishing both content nodes. Might be better suited to your requirements to be honest.
Content service save and publish raising events and putting me in an infinite loop.
Hi,
I have a page in which I select another page in the site using the multi node treepicker. When I save and publish that first page, I need it to save and publish the other page withthe initial page, so creating a link.
That's no problem, except it's raising events and then getting stuck in an infinite loop. The raiseevents = false flag appears to not do anything. I've seen other posts that do indeed say that the raised event flag is redundant, so is there another way I should be approaching this?
Many thanks in advance.
Hi Mark,
I'd be looking to use the relationship service for a feature like this. This would mean that you can update/change the relationship without publishing both content nodes. Might be better suited to your requirements to be honest.
Nik
Hi ,
Just refer this ,
public void SaveEmailSubcription(string email)
{
contentService = Services.ContentService;
var libraryArea = Umbraco.Content(4293);
}
Thanks
is working on a reply...