AlexaCRM / php-crm-toolkit

Dynamics CRM Toolkit for PHP
GNU Lesser General Public License v3.0
107 stars 42 forks source link

How add records with n-1 or n-n relationships using Alexa CRM toolkit #64

Closed alexjelin2100 closed 5 years ago

alexjelin2100 commented 6 years ago

Hello. Currently, I'm creating an application that needs to be able to write information to Dynamite CRM. My question is how to record references from an entity to another entity with this library. I've looked at another similar topic here, but I've found some good examples of how this procedure would be.

Thanks in advance for the answers.

georged commented 6 years ago

Hi @alexjelin2100

the easiest way to create/update relationship is to use lookup fields and EntityReference to set the value, e.g.

$lead->contactid = new EntityReference( 'contact', 'GUID HERE' );
$lead->update();

HTH George