I am trying to use the recently released updateContact API to update the login email of a contact/site member. Here is my front end code:
export async function updateLogin_click(event) {
let currentEmail = $w(‘#currentLogin’).value;
let newEmail = $w(‘#newLogin’).value;
let findmember = await wixData.query(“Members/PrivateMembersData”)
.eq(“loginEmail”,currentEmail)
.find()
let firstItem = findmember.items[0];
console.log(firstItem.loginEmail, firstItem._id);
let contactID = firstItem._id;
let newlogin = await updateLoginEmail(contactID,newEmail);
}
And here the backend code:
import wixCrm from ‘wix-crm-backend’;
export function updateLoginEmail(contactId, newLogin) {
wixCrm.updateContact(contactId, {
“loginEmail”: newLogin
})
.then(()=>{
console.log(“login updated”);
})
}
The code appears to be working – the “login updated” message appears on the console – but the login email for the contact is not updated. The API documentation says that this field can be updated, but perhaps there is something special about the loginEmail field? I have tried this in both Preview and Live mode. Same result. Any one else tried this?
#updateContact wix-crm-backend