Metadata contains a reference that cannot be resolved : ‘https://disco.crm8.dynamics.com/ XRMServices/2011/Discovery.svc?wsdl&sdkversion=9’.

Metadata contains a reference that cannot be resolved: ‘https://disco.crm8.dynamics.com/XRMServices/2011/Discovery.svc?wsdl&sdkversion=9’

This error is facing while connecting to dynamics crm from console application because this problem occurs when the client computer cannot send an HTTP request. The client computer cannot send the HTTP request because the connection has been closed or is unavailable. And Today I realize that My DB server was using TLS1.2 not SSL as a protocol to connect to CRM App Server, so when making a connection from DB to CRM via console app, I must explicitly set the TLS version on the ServicePointManager. Just have this code run anytime before you make the call to CRM organization service.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

To check just i have opened the chrome browser and check the certificate information. Its clearly stating protocal is TLS not SSL.

TLS1.2.png

Hope it helps.

Enjoy 🙂

Advertisements

Paging in Dynamics 365 Customer Engagement v 9.0

Paging in Dynamics 365 Customer Engagement v 9.0 :

Day to Day Dynamics CRM going very interestingly with lot of exciting features has been . One of the interesting features is client side scripting in dynamics 365 customer engagement.

If we want to retrieve multiple records , here is the syntax.

Xrm.WebApi.retrieveMultipleRecords(entityLogicalName, options, maxPageSize).then (successCallback, errorCallback);

entityLogicalNameentity logical name of the retrieve records for eg : “account”.

options : O Data system query options or FetchXML query to retrieve your data.

  • Following system query options are supported: $select$top$filter$expand, and $orderby.
  • To specify a FetchXML query, use the fetch xml  to specify the query.

maxPageSize : Specify a positive number that indicates the number of entity records to be returned per page. If you do not specify this parameter, the default value is passed as 5000. If the number of records being retrieved is more than the specified maxPageSize value, nextLink attribute in the returned object will contain a link to retrieve the next set of entities.

nextLink: String. If the number of records being retrieved is more than the value specified in the maxPageSize parameter in the request, this attribute returns the URL to return next set of records.

function paging(){

var query = “?$select=name”;
var allaccounts = null;
retrieveMultipleAccounts();
}

function retrieveMultipleAccounts() {
debugger;

var url = Xrm.Utility.getGlobalContext().getClientUrl()+ “/api/data/v9.0/accounts”;
Xrm.WebApi.retrieveMultipleRecords(“account”, query, 5000).then(
function success(result) {
var resultRetrieved = result;
allaccounts = resultRetrieved.entities.concat(allaccounts);
debugger;
if (result.nextLink != undefined) {
console.log(“Next page link: ” + result.nextLink);
query = result.nextLink;
//result.nextLink contains url, we need to remove the url and has to pass only query.
var splitValue = query.split(url);
query = splitValue[1];
retrieveMultipleAccounts();
}

},
function (error) {
console.log(error.message);
}

);

}

//allrecords variable contains the all values:

Hope it helps .

Enjoy 🙂