MS CRM update entity without change modified at and modified by - dynamics-crm

I've created a custom field in MS CRM 4 entiry used for calculations. Usually it would be filled by the plug-in handler.
How could I initialize this field for all records without changing the "modified at" and "modified by" fields?
Is it possible from Web Service API?

I've heard of people running a SQL UPDATE statements on the CRM tables without adverse effects. I've even had MSFT premier support give me an UPDATE statement to fix a problem with a user's record.

Related

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.

Query for deleted entities in Dynamics 365 XRM Tooling SDK

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.

Logic App Dynamics Connector - Record Updated - Which fields have changed?

I am building an integration system using Logic Apps connector to get details of updated records in Dynamics.
I only want to take action when certain fields have changed.
My problem is that the output from the connector shows all the fields after the record is updated.
I'd like to know which fields have changed so my Logic App can decide whether or not to take action.
Does anybody have any ideas? I was thinking of triggering the logic app via HTTP POST and post from inside a custom workflow activity when certain fields change but I wanted to hear if anyone has a better solution first using just the Logic App with Dynamics connector.
Logic app connector for Dynamics 365 exposing triggers which has record level checkpoints like create/update/delete but does not have field level filtering granularity.
Probably your decision is correct by going with Custom WF activity or a Plugin that triggers on filtering attributes of your choice, then invoking Logic app within Plugin/WF using HTTP POST.
Replacement Dataverse connector has ability to trigger based on specific changed fields using following options:
Select columns - filteringattributes - string: Enter a comma-separated list of column unique names. The flow triggers if any of them are
modified
Filter rows - filterexpression - string: Odata expression to limit rows that can trigger the flow, eg. statecode eq 0
Note: [As of 2022-Nov] The new connector is not yet available for LogicApps.
"Microsoft Dataverse (legacy) connector will be supported by Microsoft until the Microsoft Dataverse connector supports Logic Apps."
The new connector is available in PowerApps - the experience was 99% identical, difference appears to be a different billing/organizational model than Azure Logic Apps.

Microsoft Dynamics CRM SDK : Check if a field value is changed in entity

Apart from Plugins, Is there any way to check if value in entity record has changed using C# MS Dynamics CRM SDK? (Online version)
You could:
Use an on change of field workflow.
Use an on change of JavaScript function (client side only).
Programmatically examine the audit logs.
Programmatically check for record changes every 5 minutes from an external application.

I want to Access 2nd level related entity's data in microsoft CRM 2013 workflow

I want to use or get 2nd level related entity's data in Dynamics CRM 2013 workflow process but 2nd level related entity is not available
Best approach is to write a custom workflow activity to do this.
http://msdn.microsoft.com/en-gb/library/gg334455.aspx
If this is not something you can do, the alternative is to use a third party custom workflow activity that will give you what you need.
For example : http://workflowfieldlookup.codeplex.com/
Bear in mind that if you are using CRM online, some custom workflow activities may not work in the CRM online sandbox.

Resources