There is an updated version for this.
In your backend:
import { contacts } from ‘wix-crm-backend’ ;
export function myGetContactFunction ( id ) {
const contactId = id ;
const options = {
suppressAuth : true
};
return contacts . getContact ( contactId , options )
. then (( contact ) => {
return contact ;
})
. catch (( error ) => {
console . error ( error );
});
}
In the frontend:
import { myGetContactFunction } from ‘backend/contacts.jsw’ ;
//First you need the ID of the user then use this:
let userInfo = await myGetContactFunction ( user . _id );
//Then the custom fields are saved under “extendedFields”:
let extendedFields = userInfo . info . extendedFields ;
If the user is already a member you can use the function " currentMember()".
member = await currentMember . getMember ();
And then the custom fields are saved under:
member . contactDetails . customFields