Copied to clipboard

Flag this post as spam?

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


  • Ansar 181 posts 291 karma points
    Mar 26, 2015 @ 17:33
    Ansar
    0

    MemberService.Created event and Custom property values

    I am using MemberService.Created event in ApplicationStarted override for sending data from Umbraco backend members to Podio.

    The event is firing properly and I am getting member object but all the custom properties are returning null values and I can not save any data back to the member custom properties.

    Here is some code samples. Am I doinng anything wrong or is it a bug?

    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            MemberService.Saved += MemberService_Saved;
            MemberService.Created +=MemberService_Created;
            MemberService.Deleted += MemberService_Deleted;        
        }

     

        void MemberService_Created(IMemberService sender, NewEventArgs<IMember> e)
       {
            var member = e.Entity;
    string lastName = member.GetValue<string>("lastName"); //returns NULL even though I have filled out data in Umbraco back office         
            int podioId = PodioSettings.CreateMemberInPodio(member); 
                //member.Properties["memberCreatedBy"].Value = "user";   TRIED THIS WAY ALSO AND SAME RESULT
                //member.Properties["podioMemberId"].Value = createdPodioId;
            member.SetValue("memberCreatedBy", "user");
            member.SetValue("podioMemberId", createdPodioId);
            ApplicationContext.Current.Services.MemberService.Save(member, false);//NO DATA SAVED TO UMBRACO
        }

     

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Mar 26, 2015 @ 18:18
    Jeroen Breuer
    0

    Hello,

    In the created event no data is available yet because there is no data yet. The event get's fired when you choose to create a new member (before filling any properties). Did you try the Saved event?

    Jeroen

  • Ansar 181 posts 291 karma points
    Mar 26, 2015 @ 18:48
    Ansar
    0

    Saved event has the same result with empty values when creating members.

    Saved event works fine only when updating members.

  • Ansar 181 posts 291 karma points
    Mar 27, 2015 @ 09:48
    Ansar
    0

    Any help here? Its easy to check the issue - add a custom property and try to get or set the value from Saved or Created event on member creation.

    It looks like a bug and affecting the workflow we are trying to make.

    Thanks :) 

     

  • Ansar 181 posts 291 karma points
    Apr 08, 2015 @ 15:50
    Ansar
    0

    We did workaround solution to solve this.

    Now found next problem - MemberService.Saved event gets called before the Groups are saved for the Member. 

    So I change the Member Group and save a member but the member object in Saved event will still have the old Groups. 

  • Robert 27 posts 226 karma points
    Dec 28, 2015 @ 11:25
    Robert
    0

    Hi Anz,

    Struggling with the same bug, can i ask how you solved your problem?
    Tried different approaches without any luck.

    Best regards.
    Robert

  • Robert 27 posts 226 karma points
    Dec 29, 2015 @ 15:30
    Robert
    0

    Well, did solve the above problem.

    When a new member is created the Saved event is called several times, eventually the properties are set.

    //Robert

  • Simon 692 posts 1068 karma points
    Jan 18, 2018 @ 08:28
    Simon
    0

    Hi Anz,

    How did you solve the problem?

    I having the same problem.

  • 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