Create a new contact, set the company field to the...
# suitescript
j
Create a new contact, set the company field to the internalid of customer, set the contactrole field to -10 for Primary
j
Is there a way to specify an existing contact as primary?
(via script)
j
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
I mean a contact that's already on the customer. For example to change which one is primary.
j
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
Very cool! I will give it a try.
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
I know it’s been working for at least a year on my account