Scenario:
In our previous CRM system, our users had unique numeric identifiers in the form of UserID. From our internal API side we have only have access to the UserID. Our UserID has a mapping in the Contact entity. But we can't do filter queries using Dynamics Web API on Entity A since we don't have the lookup Guid for the Contact. As a result, we first make a request to the Contact entity to get the Guid and then use that response to filter Entity A.
Making two requests seems like a performance hit. What are some possible solutions to mitigate this performance hit? Anything configurable inside Dynamics 365 CRM, maybe on the field or entity level?
Another approach we're considering is caching that mapping information (User ID <-> Dynamics GUID), but even that seems like its too technical when there might be a simple solution available.
I believe Andrii has basically answered your question here:
Join and filter condition between CRM entities using Odata query
Using fetch XML you can filter your Entity A by related contact fields.
Related
I am able to retrieve filtered data against an MS Dynamics API entity by using the "$filter=Microsoft.Dynamics.CRM.In" clause on non-primary key columns. However, when I try to do the same on a primary key column with a list of GUIDs I get a bad request. I believe that this is such a simple concept that I cannot find any documentation for it. I've tried several approaches but I always receive a Bad Request response. I'm sure that this is very simple to do I just haven't found the right API Endpoint structure.
I am connecting using OATH Authentication via c#. Connectivity is not a problem, just my API endpoint.
Primary key filter URL (does not work):
https://[my business root].com/api/data/v9.2/bookableresources?$filter=Microsoft.Dynamics.CRM.In(PropertyName=#p1,PropertyValues=#p2)&#p1='bookableresourceid'&#p2=["df5c12da-0ab5-ec11-983f-000d3a543fac","28233710-0bb5-ec11-983f-000d3a543fac","8a3153a2-7ec1-ec11-983f-0022481d9391"]
Non-Primary Key filter (works without issue)
https://[my business root]/api/data/v9.2/bookableresources?$filter=Microsoft.Dynamics.CRM.In(PropertyName=#p1,PropertyValues=#p2)&#p1='sik_payrollid'&#p2=["290400","130125","270456"]
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.
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.
I’m using the CRM Online 2016 Web API. Now the only information I have is a savedQuery or userQuery record. With this I can get all records of the view, but I also want the column names of this view.
Is there an easy way to get column names using the web API with only the information of a savedQuery/userQuery record?
I already have an indirect way of getting the column names(using the LayoutXML).
Have a look into Use the Web API with Dynamics 365 metadata, this allows you get to information about the entity structure.
Not 100% if this will be better than using the Layout XML, but worth considering.
I have an e-commerce back-end fully customizable where I can see my customers' profils and sales. I would to integrate a link under the phone number or the email adress that opens the corresponding contact page on my Dynamics CRM. I've made some research and I saw some URI pattern that might be doing the job but as every entity has its own entity ID (GUID). How can I get the GUID of the entity that matches the phone number (or email) in order to open the contact page with contact displayed in it ? By Dynamics SOAP Web Services ?
Any advice will be appreciated !
Use the web api endpoint to filter the records down. For e.g. in your case customers (accounts/contacts):
Primary keys are always entityname + id (so if you entity is named foo_bar, the entity primary key (id) would be foo_barid).
http://contoso.com/myorganization/api/data/v8.0/accounts?$filter=address1_telephone1 eq '123-456-7890'&$select=accountid
Result:
{
"#odata.context":"http://consoto.com/myorganization/api/data/v8.0/$metadata#accounts(accountid)","value":[
{
"#odata.etag":"W/\"137091357\"","accountid":"12345678-abf1-e511-80d5-00155d3af123"
}
]
}
You can then build a URL which would help users navigate to the record:
http://consoto.com/myorganization/main.aspx?etn=account&pagetype=entityrecord&id=12345678-abf1-e511-80d5-00155d3af159
To use SOAP endpoint, use a library such as SDK.Soap.js or XrmServiceToolKit.js. With CRM roadmap on SOAP endpoints pretty clear (near future depreciation), web api should be the default option going foward atleast.
First of all, which programming language your e-commerce solution uses. That determines your further steps. Or rather CRM access library to choose from.
Basically, you won't have any problems if your back-end written in C#, since SDK for that language is available right away. Rest of the languages more tricky, though, I believe it is possible to find needed library anyway.
Next, your back end should query CRM for needed GUID of the record. Here an example FetchXML query for searching contact by mobilephone number:
<fetch>
<entity name="contact" >
<attribute name="contactid" />
<filter>
<condition attribute="mobilephone" operator="eq" value="555-555-555" />
</filter>
</entity>
</fetch>
Your resulting GUID will be found in contactid field of the result. By this GUID you can open record you need.
Though if you already customizing your e-commerce solution maybe it would make more sense just get all needed information from CRM and show it in your own interface?
This could be beneficial sometimes, since redirecting users to CRM might require passing authorization procedure. And this could slow down your flow.