Copied to clipboard

Flag this post as spam?

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


  • David McDonnell 37 posts 219 karma points
    1 week ago
    David McDonnell
    0

    Member Saving Event Set Custom Properties

    I am trying to set a custom value on the member item when the member is created for the first time.

    But when I call the save method on the member the custom property value does not appear in Umbraco CMS but debugging the code I can see the custom properties have their value set in after the setValue method. Any ideas why this is not presenting or saving in Umbraco 8 CMS? There are no errors thrown.

        private void MemberService_Saving(IMemberService sender, SaveEventArgs<IMember> e)
        {
    
                    foreach (IMember member in e.SavedEntities)
                    {
                        if (member.Id <= 0)
                        {
                            var guidId = Guid.NewGuid().ToString();
                            member.SetValue("customFieldName", guidId);
                            sender.Save(member, false);
                        }
                    }
       }
    
Please Sign in or register to post replies

Write your reply to:

Draft