AlexaCRM/dynamics-webapi-toolkit

Associate opportunity competitors?

CaptainCannabis opened this issue · 3 comments

Could someone provide an example for associating a M:M relation like opportunitycompetitors?

I tried the following but it results in an error

$this->API_client->Associate( 'opportunity', '76ea2948-88db-4660-a3b6-c603c7a437a4', new \AlexaCRM\Xrm\Relationship( 'opportunitycompetitors' ), [ new \AlexaCRM\Xrm\EntityReference( 'competitor', '6ff1abb9-ba90-eb11-b1ac-000d3ab39d52' ), ] );

"Associate request failed: Client error: POST https://xxxxxx.crm4.dynamics.com/api/data/v9.0/opportunities(76ea2948-88db-4660-a3b6-c603c7a437a4)/opportunitycompetitorscollection/$ref` resulted in a 400 Bad Request response with the following message: The URI segment '$ref' is invalid after the segment 'opportunitycompetitorscollection'. `

I also tried to simply create the row in opportunitycompetitors which returns null instead of an id

@CaptainCannabis

you're using intersect entity name opportunitycompetitors. The schema name of the relationship is opportunitycompetitors_association

Thanks
George

@CaptainCannabis

you're using intersect entity name opportunitycompetitors. The schema name of the relationship is opportunitycompetitors_association

Thanks
George

Thank your very much! That works...but how should someone know? The example in the tutorial uses a string like 'contact_customer_accounts', microsofts docs are like a labyrinth. Do you know any source that lists all of these naming conventions? Have a great day!