Register your Azure application to communicate with CRM
==================
Add your application details into .env
Create a .env file and add the following:
AZUREAPPLICATIONCLIENT="XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX"
AZUREAPPLICATIONSECRET="my secret key that came from azure portal"
AZUREAPPLICATIONENDPOINT="https://login.microsoftonline.com/XXXXXXXXXXXXX/oauth2/token"
AZUREAPPLICATIONRESOURCELOCATION="https://<myorganisationcrmname>.dynamics.com"
==================
Use the Microsoft Dynamics 365 Web API
https://msdn.microsoft.com/en-us/library/mt593051.aspx
==================
Examples
Post data to CRM
try {
CRM::request(
'https://your_organisation.crm5.dynamics.com/api/data/v8.2/leads',
'POST',
array(
"subject" => "Website Enquiry",
"emailaddress1" => $do->YourEmail,
"firstname" => $do->YourName,
"jobtitle" => $do->Message
)
);
} catch ( Exception $e) {
throw new SS_HTTPResponse_Exception('failure to connect to crm: '.$e->getMessage());
}
Retrieve data from CRM - return only firstname and lastname - only return the first 3 pages
try {
CRM::request(
'https://your_organisation.crm5.dynamics.com/api/data/v8.2/leads?$select=firstname,leadid',
'GET',
array(),
array('Prefer: odata.maxpagesize=3')
);
} catch ( Exception $e) {
throw new SS_HTTPResponse_Exception('failure to connect to crm: '.$e->getMessage());
}
Update a object's fields by ID
try {
CRM::request(
'https://your_organisation.crm5.dynamics.com/api/data/v8.2/leads(bf830ffd-2047-e711-8105-70106fa91921)',
'PATCH',
array(
"subject" => "123 Website Enquiry",
"email address1" => $do->YourEmail,
"firstname" => $do->YourName,
"jobtitle" => $do->Message
)
);
} catch ( Exception $e) {
throw new SS_HTTPResponse_Exception('failure to connect to crm: '.$e->getMessage());
}
Update an individual field for a object by ID
try {
CRM::request(
'https://your_organisation.crm5.dynamics.com/api/data/v8.2/leads(bf830ffd-2047-e711-8105-70106fa91921)/subject',
'PUT',
array(
"value" => "321 Website Enquiry"
)
);
} catch ( Exception $e) {
throw new SS_HTTPResponse_Exception('failure to connect to crm: '.$e->getMessage());
}
Delete a object by ID
try {
CRM::request(
'https://your_organisation.crm5.dynamics.com/api/data/v8.2/leads(bf830ffd-2047-e711-8105-70106fa91921)',
'DELETE'
);
} catch ( Exception $e) {
throw new SS_HTTPResponse_Exception('failure to connect to crm: '.$e->getMessage());
}
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem