I am having an issue updating a custom property field on a member.
When i am creating a member i am doing the following:
IMember member = _memberService.CreateMember(loginName, email, userName, "portalmember");
member.SetValue("testName", "Testname");
_memberService.Save(member);
This works fine when the member is created:
However if I want to update this value, i am trying to do the following:
public void UpdateMemberValue(string email)
{
if (!string.IsNullOrEmpty(email))
{
var member = _memberService.GetByEmail(email);
member.SetValue("testName", "TestNameUpdated");
_memberService.Save(member);
}
}
But even after the code above has been executed, the value in backoffice is still the same - "Testname"
Do you see errors in your error log. Because I have similar code working without issues.
The only thing I can think of is that the member can't be found by e-mail.
Issue with updating custom member property
Hello everyone :)
I am having an issue updating a custom property field on a member.
When i am creating a member i am doing the following:
This works fine when the member is created:
However if I want to update this value, i am trying to do the following:
But even after the code above has been executed, the value in backoffice is still the same - "Testname"
Does anyone know, what I am missing here?
I am running on version: Umbraco 10.2.0
Hi DL,
That should work, are you seeing any errors/warnings in the Umbraco logs?
Hi DL,
Do you see errors in your error log. Because I have similar code working without issues. The only thing I can think of is that the member can't be found by e-mail.
Dave
or perhaps it is returning more than one member, I don't think member emails are unique by default
Hi Huw and Dave. Thanks for your replies :)
I finally found out the issue, when I log in the user, I pass the member i found(with the created data only) and not the member with the updated data.
It was a mistake I made in the login flow. (Sorry for the confusion)
But looking into the logs started helping me finding the issue, so again thanks for the help! (Learned about the log viewer)
is working on a reply...