Ive just tried the event by adding:
export function wixMembers_onMemberUpdated(event) {
console.log(“Backend/events.js onMemberUpdated event”);
console.log(event);}
so I could see what’s inside the event. By altering a custom field in the Edit Profile on the live site, the above code was triggered 7 times, and each event didnt have the custom fields set. Are these both issues with the API call?
2 Likes
This seems to be two bugs:
The event is firing more than once per update(Edit: This may be intended behavior)- The event.entity is missing customFields
Thank you for reporting both. Will communicate this to the team.
In the meantime a workaround for the second bug is to getMember()
with the fieldsets
option set to ['FULL']
like in this example:
import { members } from 'wix-members-backend';
export async function wixMembers_onMemberUpdated(event) {
const member = await members.getMember(event.entity._id, {fieldsets: ['FULL']});
console.log("getMember customFields:", member.contactDetails.customFields);
}
I have a pretty similar issue, the event onMemberUpdated is executing multiple times after onMemberCreated. I tried the workaround doing getMember and it not works for me.