Open
Description
When I update specific fields for a record in Dynamics, if the record has since been removed (Deleted) from Dynamics, it creates blank record in its place rather than just failing as the id was not found.
What I want is a safe method of updating that will not create lots of new records when the client removes them from the CRM.
I am sure I am doing something wrong in my code, but I do not know what.
$middleware = new \AlexaCRM\WebAPI\OData\OnlineAuthMiddleware( $settings );
$odataClient = new \AlexaCRM\WebAPI\OData\Client( $settings, $middleware );
$client = new \AlexaCRM\WebAPI\Client( $odataClient );
$recordeng = new \AlexaCRM\Xrm\Entity( 'contact', $row['externalid'] );
$recordeng['engagementscore'] = $row['score'];
try {
// run your code here
$externalresulteng=$client->update( $recordeng );
}
catch (exception $e) {
echo "<br>error Trapped: ".$e."<br>";
}
This seems to relate to me pushing the id for a record that has now been removed, hence it creates the record.