Customer Creation and Update

To add or update customer fields, please do the following, call the method passing a JSONArray containing a JSONObject:

Customer.assignOrUpdateValueToCustomerFields([{key: "key1", value:"value1"},{key: "key2", value:"value2"}]
,(customer) => {
        // Do something
}, (onError) => { 
        // Log error
})

For example:

Customer.assignOrUpdateValueToCustomerFields([{
 "email": "[email protected]",
  "phone": "123456",
  "name": "Peter",
  "last_name": "Brice"
}]
,(customer) => {
        // Do something
}, (onError) => { 
        // Log error
})


Otherwise, if you want to eliminate a field, you have to do this with an array of strings containing the name of the fields:

Customer.deleteValuesFromCustomerFields({fieldNames: ["field_to_be_deleted1", "field_to_be_deleted2"]}, (customer) => {
	  // Do something
}, error => { 
		// Log error
})