Dynamics CRM - Pages from an external Web App - dynamics-crm

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.

Related

integrating third party application with Dynamics CRM

I'm trying to integrate third party application with the dynamics CRM.
Authenticate the Dynamics User > Importing all the users data into third party application is my target.
But I'm unable to find the proper way to do this. I have gone through the developer docs but didn't find the solution. Can anyone please help me with this ?
Thanks for the clarification. You can get the Web API URL from Settings > Customization > Developer Resources > Instance Web API.
It will be something like:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/
Using that URL you can query the system and get JSON results.
Going to the root URL will give you the collection name (a.k.a. EntitySetName) of all the entities in the system (which for users is systemusers).
Generally the EntitySetName will be the plural of the entity (i.e. just add 's'), but there are some quirky rules for making plurals so its best to confirm the entity set name via the API or a tool like XrmToolbox's Metadata Browser.
The most basic query for users would be:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/systemusers
It will return all fields of all users.
To get a set of fields:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/systemusers?$select=salutation,fullname,jobtitle,createdon,internalemailaddress
To add a couple filters:
https://myOrg.api.crm.dynamics.com/api/data/v9.1/systemusers?$select=salutation,fullname,jobtitle,createdon,internalemailaddress&$filter=isdisabled%20eq%20false%20and%20address1_line1%20ne%20null
Of course you have to do this with Java's XmlHttpRequest. When querying data you can use HTTP GET.
To test the above queries quickly you can simply login to the D365 web client then paste a query into the browser's address bar.
You may also want to check out Jason Lattimer's CRMRESTBuilder. While it doesn't build Java, it gives you a UI to create JavaScript XmlHttpRequests, which you can then translate to Java.
And here's some Microsoft documentation on querying the Web API.

Dynamics GUID to Primary Key mapping

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.

Getting column names of a view using CRM web API

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.

Is there a possibility to get data from google analitycs to CRM via API or else?

We have an web site and CRM. User fills form on a web page then we send this data into CRM as contact. Also Google analitycs gets more info about this user directly from web site. Is there any possible way to get data from Analitycs to combine it with CRM data?
If this is important: Bitrix24.com is used as CRM (installed on our server).
Thanks in advance.
You need this web-site: https://developers.google.com/apis-explorer/?hl=en#p/analytics/v3/analytics.data.mcf.get to construct API-request.
Set your CustomerID in filters field like this: mcf:adwordsCustomerIDPath=={customerID1}

API web site for forms-based data for all the countries, states and cities of the world

I am working on an application where I have to list on a form select lists all the countries, states and provinces, cities and it's very hard work to add them manually.
My questions are:
Is there any online service that allows me to list all countries, states and provinces, cities and give me the option to integrate them into my form and bring this information dynamically through AJAX?
Is it better to have this information in my database or work with an online service through an API?
Having a site that allows doing this, which are the most recommended and easy to integrate?
are you talking about this ?
https://restcountries.eu/
I have not used this service personally.

Resources