AlexaCRM/dynamics-webapi-toolkit

example of request with expand?

pixelpaulaus opened this issue · 1 comments

Hello,
I am trying to do a request on an account, and expand some of the account records.
when i communicate with the API via another method/wrapper i have been using, i can do so by adding in:

expand: [{ property: 'property name', select: ['*'] }]

But i am not sure how to add in the expand code for the request:

$retrievedContact = $client->Retrieve( 'account', 'IDHERE', new \AlexaCRM\Xrm\ColumnSet( true ));

could you please provide an example, i want to expand multiple account properties to be retrieved in one request.

@pixelpaulaus

I don't know what another method/wrapper you've been using so I can't comment on that. Can you provide a reference?

We do not provide expand on the Client class level. If you want, you can use OData client (available via $odataClient = $client->getClient() ). OData client includes getRecord method with queryOptions as a parameter; you can assign your expand expression to $queryOptions['Expand'].

public function getRecord( string $entityCollection, string $entityId, array $queryOptions = null ): object {

But then you're on your own to deal with what's coming back.

Having said that, it's not a bad idea. It'd be easy to add that option to the method itself but I think deserialization would need some work.