Query for deleted entities in Dynamics 365 XRM Tooling SDK - dynamics-crm

I am writing a generic integration that needs to use the database in Dynamics 365 for Customer Engagement as the system of record. I will be polling it from time to time to keep data up to date in other ancillary systems. I can know, of course, when records have changed by inspecting the "modifiedon" attribute. I can build a query saying "give me all the records that have changed since the last time I asked". It would, however, also be optimal to be able to know what records have been DELETED since the last time I asked. I have a similar integration with Salesforce, and that is trivial to do with the SalesForce API, but I can't see how to do it with the Dynamics 365 API.
It appears that the only option to me might be to keep a list of all the record primary keys in my integration, and download on each poll ALL records existing in CRM and then figure out the deleted ones on my own by their absence. That is pretty ugly and inefficient though.
Any ideas or advice?

MS introduced change tracking for this purpose.
The change tracking feature in Dynamics 365 for Customer Engagement Customer Engagement provides a way to keep the data synchronized in a performant way by detecting what data has changed since the data was initially extracted or last synchronized.
The sample web api request below:
GET [Organization URI]/org1/api/data/v9.0/accounts?$select=name,accountnumber,telephone1,fax HTTP/1.1
Prefer: odata.track-changes
Response will have delta link with a delta token:
"#odata.deltaLink": "[Organization URI]/api/data/v9.0/accounts?$select=name,accountnumber,telephone1,fax&$deltatoken=919042%2108%2f22%2f2017%2008%3a10%3a44"
When you use the above URI, you can get the changes including deleted entries.
{
"#odata.context":"[Organization URI]/data/v9.0/$metadata#accounts(name,telephone1,fax)/$delta",
"#odata.deltaLink":"[Organization URI]/api/data/v9.0/accounts?$select=name,telephone1,fax&$deltatoken=919058%2108%2f22%2f2017%2008%3a21%3a20",
"value":
[
{
"#odata.etag":"W/\"915244\"",
"name":"Monte Orton",
"telephone1":"555000",
"fax":"10101",
"accountid":"60c4e274-0d87-e711-80e5-00155db19e6d"
},
{
"#odata.context":"[Organization URI]/api/data/v9.0/$metadata#accounts/$deletedEntity",
"id":"2e451703-c686-e711-80e5-00155db19e6d",
"reason":"deleted"
}
]
}
Sample: Synchronize data with external systems using change tracking

I would like to contribute to this question which gave me excellent advice for the direction to take.
Although poorly documented on the official Dynamics doc and not mentioned where Change Tracking is explained, this powerful feature is also available in the Soap API:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.retrieveentitychangesrequest?view=dynamics-general-ce-9
https://learn.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.retrieveentitychangesresponse?view=dynamics-general-ce-9
I hope this helps someone.

Related

Google Analytics Data API: missing flag for identifying `golden` data

I've been using such API for generating reports over Google Analytics:
https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet
This API has result field isDataGolden:
Indicates if response to this request is golden or not. Data is golden when the exact same request will not produce any new results if asked at a later point in time.
Currently Google Analytics has new API for generating such reports:
https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
But there is no analogue of isDataGolden field in this API
Question:
Is such flag will be added to new API, or maybe there is another instrument to get only golden data from new API?
p.s.:
I need to use this new API, since old one does not support new analytics properties without Universal Analytics view_id
The Google analytics data api is used for extracting data from google analytics ga4 accounts. The reporting api is used for extracting data from Universal analytics accounts. These are two different systems and should not be compared. You can not use the Google analytics data api to extract data from universal analytics accounts with view ids.
If you check the documentation for RunReportResponse which is the response returned from running a reporting in google analytics data. You will find that there is no is golden property or any property of that nature.
Remember this api is still in beta the team is still working on it. One may appear in the future. You will need to wait to find out if google will add any field like this in the future as anyone who would know is probably under NDA and cant tell you.

Dynamics WebAPI: Update only changed fields?

I am writing an application that accesses Dynamics 365 CE via the webapi (v9.0 / 9.1). My application retrieves a record and displays that to the user, the user can make changes and save the record again.
In that case, my application will attempt to save the changes using a Patch call against the Dynamics WebAPI.
Is there a built in way of updating only the fields that the user had changes? This is in a web application where I can't be sure to be able to have a proper client side change tracking, meaning I either have to do another call against the CRM, compare both records and send only the updated values to the CRM or send the entire record to the CRM. The second case is obviously much more performant and easier but I can't seem to find a way to tell the WebAPI to only update the changed fields..
Retrieval of record attributes using web API & binding the values to UI controls, identifying the dirty attributes & update back the source system with only those dirty fields - this is what usual cycle will be.
What you have is issue in identifying the dirty fields - it is not actual change tracking. Try to identify them in client side using an efficient way before submitting a update server request (PATCH).
Sending whole record field values irrespective of its dirtiness is not recommended for various reasons like losing Audit track, pipeline business logic in CRM Plugin/Workflow, etc.

FHIR: Get all encounters, patients, appointments for the practice

I'm trying to use FHIR to pull all patients, encounters and appointments into an intermediate database for further analysis. Most of the FHIR API's appear to be designed to handle one patient ID at a time, or one encounter at a time, etc. What is the most efficient way to pull the full set of encounters and then keep it current, as well as appointments, etc.?
Please take a look at the FHIR specification website, specifically the page about the RESTFul API and look at search. The APIs have methods to support the interactions described on the website.

Zoho sync data between crm and mysql

I am planning to use zoho crm for my business. On on side I have clients who pay my business, on other hand I have online customer to whom I assign work given to me by clients. So basically my business is kind a mediator.
Now I want to use zoho crm workflow automation like when lead is created signup mail should be sent. I want to increase lead score when client does particular activity. I want to use webform to capture leads.
My issue is that zoho crm gives very less number of APIs like 500 per user per day. Then how do I do capture leads directly into crm. How do I increase lead score.
How do you guys manage such scenarios ?
The API Calls per day day will depend of your subscription plan.
Standard: starts with 2000 calls per day
Professional: starts with 3000 per day
Enterprise: starts with 4000 per day
Reference link
In several cases this will be enough, however there are a little tricks for saving API calls like using the API V4 in which you can insert/update multiples records (100 per request).
Also, you can use the custom function (zoho deluge) in the CRM and set yours workflow rules like:
Each time a new lead is created with the status "Not contacted" then:
Send a welcome email
Create a case (zoho deluge)
Create a taks (zoho deluge)
etc.
The rate limit for zoho custom functions is not the same as zoho api calls. (Integration Tasks - 25000 Zoho API calls/day using deluge.) So you can use both of them.
Reference link

Google my business - API to update opening hours of places?

I would like to update "Opening hours" for all stores of a company in Google my business, through an automated API (a REST service for example).
My customer has hundreds of stores, and currently this is done manually.
I've read there is NO automated way to do this, a user needs to fill manually every opening hour in the google my business portal.
I can't believe that, and I'm wondering how big companies with a lot of stores take care of that problem, especially for "exceptional closings", etc.
I have already search for a long, and didn't found anything.
The only ability supplied by google is to upload a list of stores, through a file, and this file doesn't contain any information regarding opening hours (am I wrong ?).
I would like to be able to update store list AND opening hours regularly, through an API (My Business, or Places).
Does google propose a such API, or do you have any suggestion to handle this concern from a programmatical point of view ?
Thank you
There was no Google API for My Business at the time when I posted my question, but meanwhile Google has released it and also provides samples for many languages : https://developers.google.com/my-business/
Thanks to eton_ceb for the notification.

Resources