As the title says, I am using the AlexaCRM/dynamics-webapi-toolkit package in a php project.
I have some code where I retrieve multiple records (That part works). However, I need to add a sort of filter where I only get the ones that has “modifiedon” for the last X days. Here is current working code
$pagingInfo = new AlexaCRMXrmQueryPagingInfo();
$pagingInfo->Count = 10;
$client = ClientFactory::createOnlineClient(
'https://some-microsoft-crm.com',
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
);
$query = new QueryByAttribute('contact');
$query->ColumnSet = new AlexaCRMXrmColumnSet(columnSet(true));
$query->PageInfo = $pagingInfo;
$result = $client->RetrieveMultiple($query);
The format for “modifiedon” is “2024-07-22T10:57:01Z”. (This works if I put in the exact date for $query->AddAttributeValue("modifiedon", $twoDaysAgoDateTimeFormat);
I have tried adding a parameter as some other forum suggested, but it failed every time I did the request on this line:
$query->AddAttributeValue("modifiedon", 'ge ' . $twoDaysAgoDateTimeFormat);
or
$query->AddAttributeValue("modifiedon ge", $twoDaysAgoDateTimeFormat);
Any suggestions would be helpful.