You need to sign in to do that
Don't have an account?

Setting Email Field in Contact Upsert using PHP
I am having trouble directly setting the Email field in my upsert. I have custom fields which are also have a type of "email". (np01__home_email__c, np01__alternateemail__c). The Email field takes the value of the last custom email field I set in the upsert even if i specifically set Email.
$sObject->fields['npe01__AlternateEmail__c'] = htmlspecialchars(stripslashes(strip_tags($row['email'])));
$sObject->fields['npe01__HomeEmail__c'] = 'test@test.com';
$sObject->fields['Email'] = htmlspecialchars(stripslashes(strip_tags($row['email'])));
$sObject->Email = htmlspecialchars(stripslashes(strip_tags($row['email'])));
When i upsert that object, the Email field ends up as 'test@test.com'. As you can see, I tried to set ->fields['Email'], as well as ->Email to no avail.
Can anyone see anything wrong with what I am doing?
The non-profit template has some customizations that are getting in your way. There is a field 'np01__Preferred_Email__c' that should be set to the value which reflect the np01__x email field that you wish to use as the main email address.
If you want np01__home_email__c to be the primary email address, set that field to the email address and set 'np01__Preferred_Email__c' to 'Home'. Do not bother to set Email as it will be overridden when you set the other fields.
Park
All Answers
The non-profit template has some customizations that are getting in your way. There is a field 'np01__Preferred_Email__c' that should be set to the value which reflect the np01__x email field that you wish to use as the main email address.
If you want np01__home_email__c to be the primary email address, set that field to the email address and set 'np01__Preferred_Email__c' to 'Home'. Do not bother to set Email as it will be overridden when you set the other fields.
Park