var doc = contentServices.GetById(item.Id);
doc.SetValue("schedule", page.Id+",7190");
contentServices.SaveAndPublishWithStatus(doc);
umbraco.library.RefreshContent();
var asd = doc.GetValue("schedule");
I get 'doc' properly and when I check the value of 'asd' with a breakpoint, it is as I set it with 'SetValue', but when i finish the process and look at my backoffice, multinode treepicker is still empty.
Set multinode treepicker value programmatically in Umbraco 7.10
How do I set the value for a multinode treepicker in c#. I found the post from 2015: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/71722-setvalue-in-multi-node-tree-picker but it doesn't seem to work. Here is my code:
I get 'doc' properly and when I check the value of 'asd' with a breakpoint, it is as I set it with 'SetValue', but when i finish the process and look at my backoffice, multinode treepicker is still empty.
I'm building it based on its GUID:
Thanks for this answer, saved me some time ;)
Btw, you can make your code a little bit faster and safer like this:
A note that the guid key shouldn't include - chars
For example when you get some records by contentService:
Then you want to get the value to set to multinode treepicker property, you will do this:
Hope it help.
Cheers.
is working on a reply...