They are, it seems to be failing with certain mntp fields so its running through property convertors and possibly failing. The xml is up to date I checked it also getting the raw value when not running through the property convertor i get the actual csv values set.
I am just stepping through code and mntp properties work except for 2 of my properties even though in xml there are ids in line:
public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
{
// Get the data type "content" or "media" setting
/*
var dts = ApplicationContext.Current.Services.DataTypeService;
var startNodePreValue =
dts.GetPreValuesCollectionByDataTypeId(propertyType.DataTypeId)
.PreValuesAsDictionary.FirstOrDefault(x => x.Key.ToLowerInvariant() == "startNode".ToLowerInvariant()).Value.Value;
var startNodeObj = JsonConvert.DeserializeObject<JObject>(startNodePreValue);
var pickerType = startNodeObj.GetValue("type").Value<string>();
*/
if (source == null)
{
return null;
}
var nodeIds = (int[])source;
Right mystery solved. Total epic fail on my part. The mntp target items live a couple of folders down in a parent folder called non page content. This was showing as being published but was actually not published as it was saying sorry not in xml cache. So republished that and all children now it all works.
Please excuse me while i now go and bang my head against the wall #epicfail.
var newsItems = new List<IPublishedContent>();
Model.Content.GetPropertyValue<string>("newsItems").Split(',').ToList().ForEach(x => newsItems.Add(Umbraco.Content(x.ToString())));
Just a bit of a work-around if you get stuck on this
But if I connect to my local database this method fails, on the live database the other one returns nulls.
How can they be different?
ok - answer to my own problem.
I was in the process of upgrading so my live one had a Property Editor of type:
Umbraco.MultiNodeTreePicker
and the local one was
Umbraco.MultiNodeTreePicker2
GetPropertyValue returns null
Guys,
I am using umbraco 7.3.3. On my doctype i have 3 mntp properties. I am also using https://our.umbraco.org/projects/developer-tools/umbraco-core-property-value-converters/ everything was working but now 2 of my properties always returns null. I am doing
I also tried
Also get null. I checked the xml config data is there and looks good. When i do
I get csv list of values.
Any ideas?
Regards
Ismail
Have you tried iterating over the MNTP to see if any data comes out as outlined here?
https://github.com/Jeavon/Umbraco-Core-Property-Value-Converters/blob/v2/Docs/MultiNodeTreePicker.md
Hi Ismail,
Are the selected pages published ?
Dave
Dave,
They are, it seems to be failing with certain mntp fields so its running through property convertors and possibly failing. The xml is up to date I checked it also getting the raw value when not running through the property convertor i get the actual csv values set.
Regards
Ismail
I just had a brief look at the source.
It should return null when you UmbracoContext.Current is null only ?
https://github.com/Jeavon/Umbraco-Core-Property-Value-Converters/blob/v2/Our.Umbraco.PropertyConverters/MultiNodeTreePickerPropertyConverter.cs
Dave
I am just stepping through code and mntp properties work except for 2 of my properties even though in xml there are ids in line:
its null.
This is really really weird
What happens if you disable the property value convertor ?
You can remove it in the starting event
Do you get a list of id's when you do :
Dave
Dave,
Not tried that but if i bypass the resolver by doing
I get csv list of ids.
So its there in the xml, I also checked the umbraco.config and it's there. I have raised issue here as well https://our.umbraco.org/projects/developer-tools/umbraco-core-property-value-converters/feedback//75391-some-mntp-properties-return-null I think it may be underlying umbraco issue with that particular property??
Regards
Ismail
Right mystery solved. Total epic fail on my part. The mntp target items live a couple of folders down in a parent folder called non page content. This was showing as being published but was actually not published as it was saying sorry not in xml cache. So republished that and all children now it all works.
Please excuse me while i now go and bang my head against the wall #epicfail.
Regards
Ismail
Don't break the wall :-)
Dave
Just a bit of a work-around if you get stuck on this
ok - answer to my own problem. I was in the process of upgrading so my live one had a Property Editor of type: Umbraco.MultiNodeTreePicker and the local one was Umbraco.MultiNodeTreePicker2
is working on a reply...