Tag: Author:Rawish

How to setup a mock service in SOAP UI. See CRM output XML. Integration Plugins Microsoft Dynamics CRM 2016/2015/2013

During my Career in CRM dynamics, I have struggled a lot when it comes to seeing what is going out of CRM so that it can be used to investigate things.

Especially the people who involve in a lot of triaging of issues & developing integration plugins and needs to validate it.

prerequisites:

  1. WSDL of the target service.
  2. SOAP UI(any version would work)
  3. Up and running server where you have SOAP UI installed.

Open SOAP UI and create a new project:

wsdlBrowse to the WSDL and click okay.

now it’s time to generate a mock service:

once you have imported the WSDL it will show all the services it contains.You have to select the one you want a mock service for. and then right click on it and say generate mock service like below:

generate mock

once you do that it will give you the list of operations and the path of the mock service.

Verify the same and click okay:

mock

here you go your mock service is ready:

runservice

Now you might have to modify the response you are getting from mock service to do that double click on the service (e.g here “buy”) than on the response add whataver you need.

close the box. click on the green button to run this service.addresponse

now in order for your CRM to reach to this service you have to configure this end point. either in your config file or if you read it from a custom entity in CRM.

now the endpoint would be the combination of your server address for.e.g.

10.112.22.10:PortNumber/MockServicePath.

you can get the mock service Path from the custom properties box on the left bottom.side.

side.

once you do that all you have to do is to trigger the action and once you do that you have the request coming in the mock service in the below section:

request.JPG

double click on that than on the option format XML to see the XML you need.

 

Hope it helps.

Cheers!

How to enable encryption on microsoft dynamics crm 2016/2015/2013/365

Hi, Guys! I am going to show you today how to enable encryption in Microsoft Dynamics CRM. But first let’s have a look why one would want do that:

  1. you are not able to create queues.
  2. you are not able to create mailboxes.

In short, all confidential stuff in CRM where you require a user name or password it will be disabled if you have encryption disabled.

if you try to take action mentioned above you will get this error:

“There are encrypted fields in the organization database, but the data encryption feature isn’t activated. Contact your Microsoft Dynamics CRM system administrator to activate data encryption. To activate, go to System Settings > Data Management > Data Encryption…”

According to the error, to enable encryption we need to go into Data Encryption under Data Management. However, we can only enable Data Encryption if Dynamics CRM is using the https protocol, and usually, the reason we’ve done a backup/restore is that we’re setting up a Dev or UAT copy of Prod, which may not need to be https.

Data Encryption Errors After Restoring Microsoft Dynamics CRM Database

This error states that “The HTTPS protocol is required for this type of request. Enable the HTTPS protocol and try again.” However, enabling https may not be ideal, and we still need to be able to use the system.

Fortunately, there is a SQL script we can run on the config database which will allow us to use data encryption without using the https protocol:

UPDATE [MSCRM_CONFIG].[dbo].[DeploymentProperties]
SET [BitColumn]=1
WHERE ColumnName=’DisableSSLCheckForEncryption’

You shouldn’t do this on a production instance, but for Dev or UAT instances this is necessary.

Once that’s updated you need to do an IISRESET on the CRM server for the changes to take effect.

If we try opening that Data Encryption window again, we should see that encryption is disabled, and we can create a new key and activate it.

Data Encryption Errors After Restoring Microsoft Dynamics CRM Database

You should be able to get the encryption key from the original CRM system you backed up from. If not, then you can simply create a new encryption key.

When you activate, you might be faced with another error which states “Please select an account that is a member of the PrivUserGroup security group and try again”

Data Encryption Errors After Restoring Microsoft Dynamics CRM Database

A simple solution to this issue would be to use an account with which the CRM instance is installed or add this user to the security group mentioned in the error.

 

Cheers!!

 

Get lookup value from other entity and set it on the form using Web API in Microsoft Dynamics CRM 2016

In this blog i am going to show you , how you can retrieve a lookup value from other entity in CRM 2016 using web api and set it on the form.

we know how its done in Odata but its time for some Web API action.

let see how its done here 🙂

function yourFunctionName() {
var lookup= Xrm.Page.getAttribute(“fieldname”).getValue();  //you will get the id with exxtra double quotes or square brackets by doing get value hence you to make it readable by CRM , you must slice it. i have use the below method:
var newid = lookup[0].id.slice(1, -1);  // you will get perfect id like “EDCJDKDJDKJDJDKJDJKD” here.

var req = new XMLHttpRequest();

once you have the id , you have frame to make a webapi GET call by proving the newid we got.

req.open(“GET”, Xrm.Page.context.getClientUrl() + “/api/data/v8.1/entitypluralname(” + newid + “)?$select=_prefix_fieldname_value”, true);
req.setRequestHeader(“OData-MaxVersion”, “4.0”);
req.setRequestHeader(“OData-Version”, “4.0”);
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
req.setRequestHeader(“Prefer”, “odata.include-annotations=\”*\””);
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var result = JSON.parse(this.response); // you will get the retrieved value in object we stored in result var.

var retrivedvalue= result._prefix_fieldname_value; //get the id of the field
var retrivedformatedvalue= result[“_prefix_fieldname_value@OData.Community.Display.V1.FormattedValue”]; //get the formatted name of the field
if (retrivedvalue!= null) {
var value = new Array();
value[0] = new Object();
value[0].id = retrivedvalue;
value[0].name = retrivedformatedvalue;
value[0].entityType = “entityname”;

Xrm.Page.getAttribute(“fieldname”).setValue(value); //set the lookup value finally
}
else
alert(“some textt!!!!!!”) // optional
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();

you can call this function on change of the field.

i hope this helps!!  🙂

cheers

how to retrieve lookup value and set it on another lookup field in Dynamics CRM 2016 Javascript

In this blog i am going to show how you can retrieve a lookup value and set it.

for e.g if you need to set one contact which in a regarding field on an activity to another contact field.

use the below simple JavaScript:

function yourFunctionName()

var lookup = new Array();  // create a new array
lookup = Xrm.Page.getAttribute(“regardingobjectid”).getValue(); // get field value
if (lookup != null) {
var name = lookup[0].name; // get the name of the record
var id = lookup[0].id; // get the  id of the record
var entityType = lookup[0].entityType; // get the entitytype

now we have retrieved all information that we needed ; its time we set it 🙂

if (entityType == “contact”) { // ignore this step if its not a multilookup field

var value = new Array(); //create a new object array
value[0] = new Object();
value[0].id = id; // set ID to ID
value[0].name = name; //set name to name
value[0].entityType = “contact”; //optional

Xrm.Page.getAttribute(“from”).setValue(value); //set the value.
}

}
}
}

 Call this function on Onload of the required form.

hope it helps !!

cheers