Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 25, 2016 @ 12:20
    Ismail Mayat
    0

    some mntp properties return null

    Hello,

    I had this all working on a site. We got doc type with about 3 mntp properties and the convertor was firing fine. Client the added content and now for certain properties the converter always returns null.

    When i get raw value DataValue i get the csv list. However when i step through code and look at

      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;
    

    nodeIds is null for that same property, Going further up the call stack,

     public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            var nodeIds =
                source.ToString()
                .Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();
    
            return nodeIds;
        }
    

    source is null this is really weird.

    Any ideas?

    Regards

    Ismail

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 25, 2016 @ 12:27
    Jeavon Leopold
    0

    Strange, so object source is null when entering the ConvertDataToSource method?

    What version of Umbraco are you on?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 25, 2016 @ 12:28
    Ismail Mayat
    0

    Jeavon,

    7.3.3. I have a different db no my dev server and it all works fine on there. Its really really weird.

    Regards

    Ismail

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 25, 2016 @ 12:31
    Jeavon Leopold
    0

    Umbraco is sending the data into that method so if it's null there something is up. Have you already done the standard clear of umbraco.config, Examine indexes etc....?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 25, 2016 @ 12:33
    Ismail Mayat
    0

    Jeavon,

    Yup but will try it again.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 25, 2016 @ 14:40
  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 29, 2016 @ 09:28
    Jeavon Leopold
    0

    Happens to us all sometimes :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies