Api V8 adds email address 2x to contact after setting the relationship

Hi,

I’m trying to set an (primary) email address on a contact following the solution provided in [How to add an email to a contact module using the v8 API?] and it seems that the email address gets linked 2 times to the contact. It gets linked as the primary address and also as a normal address. Is there a way that I can only set the primary email address of a contact? Do I need to use a special relationship name when creating the link and where can I find these relationship names as this is not very well documented. Any help is highly appreciated.

Best regards,
Davy

Hi,
I’m putting this up here for people having the same issue.

I’ve accidently stumbled upon the solution (at least part of it) by checking the bugs on github:
https://github.com/salesagility/SuiteCRM/issues/8687

Apparently you can simply add an email1 attribute in your post or patch to change the primary email address of a contact. Also make sure that the email address that you supply complies with the email address format allowed for SuiteCRM otherwise it will not set the email address.

Best regards,
Davy

1 Like