Create a new contact, set the company field to the internalid of customer, set the contactrole field to -10 for Primary
j
jen
05/29/2020, 10:01 PM
Is there a way to specify an existing contact as primary?
jen
05/29/2020, 10:01 PM
(via script)
j
JohnnyC
05/29/2020, 11:02 PM
if you use nlapiAttachRecord or record.attach and provide attribute {role:-10}. That should do it. Setting the contactrole field only seems to work when the contact is part of a customer. For a vendor you would need to use attach.
j
jen
05/31/2020, 4:43 PM
I mean a contact that's already on the customer. For example to change which one is primary.
j
JohnnyC
05/31/2020, 4:51 PM
If you set the contactrole field on the contact to -10 and save the contact that should work for a customer. The previous primary contact will no longer be primary. Using attach as I described also works regardless of the contact already been linked to the given customer.
j
jen
05/31/2020, 4:59 PM
Very cool! I will give it a try.
jen
06/01/2020, 3:39 PM
OMG. It actually works. You need to use 'role' not 'contactrole' though. We abandoned a project about 2 years ago because NS told us this couldn't be done via script.
j
JohnnyC
06/01/2020, 4:13 PM
I know it’s been working for at least a year on my account