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?
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 }
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?
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?
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
Saved event has the same result with empty values when creating members.
Saved event works fine only when updating members.
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 :)
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.
Hi Anz,
Struggling with the same bug, can i ask how you solved your problem?
Tried different approaches without any luck.
Best regards.
Robert
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
Hi Anz,
How did you solve the problem?
I having the same problem.
is working on a reply...