Copied to clipboard

Flag this post as spam?

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


  • jonny cundall 15 posts 157 karma points
    Apr 22, 2018 @ 17:51
    jonny cundall
    1

    I can't work out why this member property is not saving

    Hi folks I wonder if anyone can tell me what I am doing wrong here.

    I have a form where an artist can sign up to an event, giving various details. this is saved in a content item. Now I am trying to give the artist a login so they can edit their details. So I have created a member, and want to associate it to the artist's content item so my edit form knows what content to edit.

    the property has type Umbraco.ContentPicker2 . I am able to set a suitable value in the umbraco admin site without problems

    in SignupController.cs

    var member =  Services.MemberService.CreateWithIdentity(model.Email, model.Email, password, "ArtistMember");
    
    if (member.HasProperty("artistContent"))
       {
          member.SetValue("artistContent", artistId);
       }
    Services.MemberService.Save(member);
    

    The result is that the member is saved, but the property is not. I can debug through the code and see that the "SetValue" line gets hit. I tested out adding a text field, and that was saved successfully.

  • jonny cundall 15 posts 157 karma points
    Apr 23, 2018 @ 06:29
    jonny cundall
    100

    In case anyone has the same problem, this was the fix

    member.SetValue("artistContent", artistUdi.ToString());
    

    where artistUdi is

    savedArtist.GetUdi()
    
  • 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