Copied to clipboard

Flag this post as spam?

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


  • athul 26 posts 117 karma points
    Nov 30, 2017 @ 07:03
    athul
    0

    Unable to get value from newly created property in Member

    I am Creating a new member in Umbraco like this

            var member = new MembershipManager.BLL.Member();
        var umbMember = memberService.CreateWithIdentity(userName, userName, "", "Member");
        memberService.SavePassword(umbMember, password);
    
        umbMember.IsApproved = true;
        memberService.Save(umbMember);
        memberService.RebuildXmlStructures();
    

    After this step, I am trying to access a value inside one of its property (property is made of Umbraco ArchType)

    var memData = umbMember.getProperty("myOrder").Value;

    And it is giving me Null. Once I go to Membership area and manually save this new member again it is giving me correct value

    {"fieldsets":[]}
    

    How can I enable this Via code so that after creating each member I don't have to go and save it in Umbraco Back Office

  • Ben Palmer 180 posts 866 karma points c-trib
    Nov 30, 2017 @ 08:30
    Ben Palmer
    100

    Hi athul,

    If I'm understanding this correctly, you just need to set the default value when creating the member, you can use the SetValue method on the member like this:

    member.SetValue("myOrder", "{\"fieldsets":[]}\");
    

    I'm not 100% sure that the second parameter is correct here but should put you on the right path at the very least.

Please Sign in or register to post replies

Write your reply to:

Draft