Question:
How to find custom fields exact keys so that they can be used when registering new members from code?
Product:
Velo
What are you trying to achieve:
I’m trying to build a custom registration process, where members/contacts have custom fields that I already added on the site dashboard.
What have you already tried:
My code looks like:
import { authentication } from 'wix-members-frontend';
$w.onReady(async function () {
const options = {
contactInfo: {
//the keys of customFields are identical to the names of custom fields as I can see them on the site dashboard, under Contacts/Members
customFields: {"Company": "xyzzy", "Position": "abcd", "First Name": "abcd"}
},
privacyStatus: 'PRIVATE'
};
return authentication.register(email, password, options)
.then((registrationResult) => {
//return registrationResult;
const status = registrationResult.status;
if (status === "PENDING") {
console.log('Member registered and waiting for approval:', registrationResult);
} else {
console.log('Member registered and logged in:', registrationResult);
}
})
.catch((error) => {
console.error(error);
})
}
And I always get some error.
The last error I got is:
Unexpected value for field str_value @ @"
Additional information:
All my custom fields have thee type Text, and everything provided in the code through the dictionary customFields is Text too. Some of them were converted to string using JSON.stringify().