ec
06/04/2025, 2:09 PMCeligo AI
06/04/2025, 2:10 PMAI generated answer (using internal Slack threads):Based on the conversations, it appears that you can use
record.attach
to set contact roles for a customer. However, the role attribute may not be set as expected in some cases.
Here is a sample code snippet that was used to attach a contact to a customer:
code
Nrecord.attach({
"record":{
"type":"contact",
"id":32602
},
"to":{
"type":"customer",
"id":32603
},
"attributes":{
"role":-10
}
});
In this example, the role was not being set as Primary Contact
even though -10
is the internal ID for Primary Contact
. It was suggested that the customer record can only have one primary contact, but the issue persisted even when the customer record did not have a primary contact.
In another conversation, a similar issue was encountered when trying to attach a contact to a vendor and assign the primary contact role. The issue was resolved by ensuring the to:
field only contained type
and id
key-value pairs:
code
record.attach({
record:{
type: record.Type.CONTACT,
id: contactId
},
to:{
type: record.Type.VENDOR,
id: context.request.parameters.custpage_venid
},
attributes: {
role: -10
}
})
Please note that the role attribute may not always behave as expected, and you may need to adjust your code accordingly.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
06/04/2025, 2:10 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855098665
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845591724
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842879653
Celigo AI
06/04/2025, 2:10 PM