Relabeling Composite Control Fields

We can change display name of the entity fields easily by editing field display name property. But we can’t change fields label used in address composite controls. In this post we are demonstrating how to relabel composite control fields.

Requirement:Relabel city field in address composite control in account entity.

Note: You can’t change field logical name once it is created.

Solution: We can implement this requirement using Java Script. We have option to access composite control using Java Script, we can refer them using following way:

<composite control name>_compositionLinkControl_<constituent attribute name>

So if we want to refer any field which is used in the composite control, We can do like following, we are accessing city field here:

<composite control name>_compositionLinkControl_address1_city

To relabel the normal fields, we can use setLabel method. so we can use the same method to relabel city as well. let’s say we want to rename city field to “Distric”. We can use following code for that:


Similarly we can refer other fields as well.You can refer composite control name from the respective entity form or you can also refer it here.

Using Code: To use this code we need to create Java Script web resource, where we can have below method. We need to call this method on Onload of the account entity form.

function RelableAddressControl()





Now after publishing our changes, when we will open any account record we will see changes like below:


HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !!


Leave a comment

Filed under MS CRM 2011, MS CRM 2013, MS CRM 2015, MS CRM 2015 Update 1

A free customizable Editable Grid for Dynamics CRM 2013/2015!


How many times have you heard “This grid is great, but I hate double clicking and going into the record to edit it, then going back to my record.”  I certainly have heard it many times from many clients.  In fact I feel the same way sometimes.  It gets really annoying that you have to go into each record and change one attribute.  Why can’t MSFT build this into the system?  It’s not hard…well maybe it is.

At BusiPlanIT labs, we have done the hard work for you and come up with a solution that leverages JQuery js, JQuery UI js, and SlickGrids js.  We have created a full HTML5 solution for you that works in CRM 2013 and 2015.  Oh and let’s not forget the different browsers!  It works on Chrome, Internet Explorer, and Firefox.

We are offering one free grid for any use in the CRM.  You…

View original post 1,820 more words

Leave a comment

Filed under Uncategorized

Rearrange Existing Command/Ribbon Buttons in Microsoft Dynamics CRM

Did you ever get requirement to rearrange existing buttons, there was one question today in Microsoft Dynamics CRM Community Forum where user wanted to rearrange existing buttons so thought of writing a quick post so that it can help others.

Requirement : Requirement : Rearrange existing command or ribbon button for entity in CRM, Let’s say we want to rearrange buttons on Activities, so for example currently activities show buttons like below in home gird view:


So let’s say we want to rearrange them like below:


Solution: Follow below steps to implement this requirement

  • Download and import latest Ribbonworkbench soltuon and import it to your organization, we are doing it on MS CRM 2015.
  • Create a Solution (Settings->Solution->New) and fill required details and Save.
  • Click on Entities->Add Existing Entity and select activity entity like below:third
  • Save and Close your solution.
  • Open Ribbonworkbench solution and select your Solution name that is created in last step
  • Select Ribbon tab (next to Command Bar) and right click on Task button and select Customize Group option
  • Simply Drag button to some empty area and then drag back to new place like below:


  • Click on Publish and refresh your CRM browser window, you should be able to see your changes.

HIMBAP | Contact US 


Leave a comment

Filed under MS CRM 2013, MS CRM 2015

Using Actions in Microsoft Dynamics CRM 2015

There was one question today in Microsoft Dynamics CRM Community Forum, where user was looking for the information about what is the use of Entity input parameter in Actions, so thought of writing a post, so that it can help others.

About Actions: Microsoft Dynamics CRM actions allows us to define our own custom events/messages, similar to existing standard events like Create,update,delete. Actions are designed using CRM process editor or using SDK and we can define parameters both (input and output) for these actions just like we have parameters for standard messages, for example if you want to use Create message, it takes Entity object as parameter and returns record GUID as output. Once activated we can also register plugin on the same.

You can get more details about action here:

Action Example: We are going to demonstrate how we can create and call actions. Actions provide us option to define different type of input and output parameters, but here we are going to demonstrate use of Entity and EntityReference Parameter. So let’s take an example that we want to create Contact from Account, very simple example for the demo. While creating contact we want to use information like name, email, telephone from account entity. Now to pass this information we have two option either we can pass all these fields from account to contact one by one or we can simply pass account entity object so that required field can be collected from there. So let’s create a action where we will use two input type of parameter, Entity and EntityReference, from entity we will use above fields and using entityreference we will get it of the sales person (we have created a custom lookup field on contact entity), using following steps to design action:

  • Navigate to Settings->Process->New.
  • Use following details and click on OK :
    1. Process name: ActionDemo
    2. Category: Action
    3. Entity: None(global)
    4. Type: New blank process
  • Add a Input parameter of Entity type for ParentAccount record like below:


  • Add another input parameter of type EntityReference to get Salesperson


Now let’s say we want to use these parameters to create our contact record, so follow below steps to create contact record using these parameters:

  • Click on Add Step and select Create Record step under drop down


  • Select Contact under Create drop down like below and click on Set Properties.
  • Now we will be using our Entity object input parameter to fetching different property and will be setting in contact record
  • Select the field that you want to set, for example we want to set Account Name, so click on Account Name field and click on OK after setting following options from Form Assistant like below:


  • Similar we can select other fields like Email, Mobile, Firstname, Last name from account entity object like belowcotnact
  • Now select the Sales person field and select out second parameter from Form assistant like below (Note: We have created a custom lookup for Sales Person field in Contact entity) and click on Save and Close

salespersonNow we need to activate our action and we can call it using server side code, client side code and using other Workflow and dialogs as well (new feature in CRM 2015). We ca use following code call our action:

//we have written method to get CRM service object
IOrganizationService service = connection.GetCRMService();
//retrieve account record using that we want to create contact
Entity accountObj = service.Retrieve(“account”, new Guid(“699D9F32-9B10-E511-80FD-C4346BAD3138”), new ColumnSet(true));

//Create organization Request object and pass action name as parameter
OrganizationRequest Req = new OrganizationRequest(“new_actiondemo”);
Req[“ParentAccount”] = accountObj; //passing our first parameter
Req[“Salesperson”] = new EntityReference(“systemuser”, new Guid(“90322292-C8EC-4A72-8B32-B79DEF7DD31C”));
//use execute method to call action
OrganizationResponse Respons = service.Execute(Req);

After execution of the code we can see in CRM contact record is created by action like below:


So in above example we show if we need to pass multiple parameter we can use Entity object instead of passing field value one by one and entity reference is used to for passing a single entity reference instance.

HIMBAP | Contact US 


Filed under MS CRM 2015 Update 1

Using Upsert in Microsoft Dynamics CRM 2015 Update 1

Another useful feature that is introduced in Dynamics CRM 2015 update 1 is support for upsert operation. Upsert allows us to create or update record in CRM in single call, so we don’t need to bother if there is any existing record with the same keys or combination of other fields. This is specially useful in case of integration, when we are not sure that record from other system is already integrated with CRM or not. We can use upsert with alternate keys, Please refer our earlier post for how to use alternate keys. Let’s take below example where we are writing a account request, using upsertrequest,

Entity account = new Entity(“account”, “accountnumber”, “UPST601”);
account[“name”] = “Upsert Demo”;
account[“revenue”] = new Money(5000);

UpsertRequest request = new UpsertRequest()
Target = account

UpsertResponse response = (UpsertResponse)service.Execute(request);
if (response.RecordCreated)
Console.WriteLine(account[“name”] + ” Created with Revenue: ” + account.GetAttributeValue<Money>(“revenue”).Value);
Console.WriteLine(account[“name”] + ” Updated with Revenue: ” + account.GetAttributeValue<Money>(“revenue”).Value);

account[“revenue”] = new Money(15000);
UpsertRequest request1 = new UpsertRequest()
Target = account
response = (UpsertResponse)service.Execute(request);
if (response.RecordCreated)
Console.WriteLine(account[“name”] + ” Created with Revenue: ” + account.GetAttributeValue<Money>(“revenue”).Value);
Console.WriteLine(account[“name”] + ” Updated with Revenue: ” + account.GetAttributeValue<Money>(“revenue”).Value);

As you can see in above code we are executing upsert request two times, so first time as this record is not available in CRM, it will create it, but while executing next statement it will update existing record instead of creating it,


HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !!

Leave a comment

Filed under MS CRM 2015 Update 1

Using Alternate key to update entity record- Microsoft Dynamics CRM 2015 Update 1

If you have worked on integrating CRM with another system like ERP, you might have maintain different keys for your ERP records for the synchronization purpose. But now you do need to that any more !! Microsoft Dynamics CRM 2015 Update 1 introduced new feature which allows us to assign alternate unique keys to entity which can help us to update entity record, this is specially useful for integration because you need to keep both keys from both the system to synchronization of the data between two systems. This key can help you to create/update data in CRM without querying entity record primary GUID, which means alternate key will act like a primary key. You can add alternate keys by following below steps

  1. Navigate to Settings-> Customizations->Customize the System
  2. Select your entity and expend it, let’s say in our case we want to use Account entity.
  3. Click on Keys->New to setup alternate key for account.
  4. Provide display name for your alternate key, let’s say we want to name it as Integration key
  5. Select source field where want to store this key, so let’s say want to utilize Account Number field, select Account Number and click on Add button.
  6. Save and Close key dialog.


Now this field will be holding another key field for us that we can use to update this record. So let say first we want to create account record and by setting this key, we can use following code:

//Create Account object with alternate key field and value

Entity account = new Entity(“account”, “accountnumber”, “ERP12345”); 

account[“name”] = “Alternate Key Test”;


So our account record is created like below


Now as this account is created with alternate key, we can simply update this account with the help of alternate key without using accountid field (primary key) like below

Entity accountUpd = new Entity(“account”, “accountnumber”, “ERP12345”);

accountUpd[“name”] = “Alternate Key Demo”;

accountUpd[“websiteurl”] = “”;


Now our account record is updated:


So, we can use alternate keys to update entity records now !!

HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !!

Leave a comment

Filed under MS CRM 2015, MS CRM 2015 Update 1

Improved update method –Microsoft Dynamics CRM 2015 Update 1

Microsoft Dynamics CRM 2015 Update 1 released some new features that will be very help for developers. In this post we will discuss new improvement in Update method. In earlier version we had different request for the special operations for example AssignRequest for changing owner once record is created, SetStateRequest to change the status of entity record. But now with the release of CRM2015 Update 1 we don’t need to use request (they are deprecated). We can simply apply these operation in the update request only.

For example below is the request to update account record and assign to another user and change status to inactive:

OrganizationService service=GetCrmService();

//Create account object

Entity account=new Entity(“account”);

//set account id

account[“accounted”]=new Guid(“af393105-2a98-407b-9215-6113f19498ad”);

//Assign this record to dev user

account[“ownerid”]=new EntityReference(“systemuser”, new Guid(“af80d7b3-e5e1-4b52-a141-a594f24ee015”);

//set account status to inactive

account[“statecode”]=new OptionSetValue(1);

account[“statuscode”]=new OptionSetValue(2);

//call update method






HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !!

Leave a comment

Filed under MS CRM 2015 Update 1, Uncategorized

Deleting Microsoft Dynamics CRM 2013 Organization from SQL

Requirement: Delete Microsoft Dynamics CRM Organization

Solution: We can follow below steps to delete Dynamics CRM Organization from DB.

  1. Connect to CRM DB server and right click on CRM organization DB (for example DEMO_MSCRM)
  2. Select Delete and make sure to select Close existing connections


This will delete organization DB , but we also need to remove Organization references from MSCRM_CONFIG DB, so follow below steps.

  1. Fire below select statement against MSCRM_CONFIG DB

select * from [dbo].Organization

  1. Note down ID of your organization, we need it for below queries.
  2. Execute following commends against MSCRM_CONFIG DB, you can change parameter and run all of them in one go

         delete from [dbo].[OrganizationFeatureMap] where OrganizationId=’ORG_GUID’

         delete from [dbo].SystemUserOrganizations where OrganizationId=’ORG_GUID’

         delete from [dbo].[OrganizationProperties] where Id=’ORG_GUID’

         delete from dbo.Organization where DatabaseName=’ORGNAME_MSCRM’

Note: This is an unsupported method of removing Organization DB and should be used only when not able to delete organization from Deployment Manager for specific reasons.

Hope it will help someone !!

Leave a comment

Filed under Uncategorized

Removing Stored Credentials for Microsoft Dynamics CRM SDK Samples

If you want to remove credentials stored in configuration file for Microsoft Dynamics CRM SDK sample then this post is going to help you to implement that.

Requirement: Remove stored credentials from configuration file.

Solution: When you will try to run Microsoft Dynamics CRM SDK sample code first time it will ask you for credentials details like below (we are doing demo with Microsoft Dynamics CRM 2015 Online)


Once connected, it will store your credentials details in Credentials.xml file and next time when you will try to run sample again it will show you option to select existing configuration to connect to your CRM server.


We can add maximum 9 configuration, and if you want to remove any stored credentials details, you can go to C:\Users\<username>\AppData\Roaming\CrmServer\Credentials.xml location and can open credentials.xml file in any text editor. We can remove particular configuration or can delete all configuration based on requirement. Save your changes and now next time when you will try to run application it won’t show your that configuration details.


HIMBAP | Need any help in Microsoft CRM 2015 Development Contact US !!

Leave a comment

Filed under CRM Dvelopment Series

Overriding out of box command button behavior – Step by Step

Did you get a requirement to override a system ribbon or command button?? If yes then this blog post going to help you to implement your requirement.

Requirement: Let’s say we have requirement to prompt user before saving the record and based on select we need to save or cancel save operation.

Solution: We can create a custom button to replicate out of box button, we will be calling same method that is called on out of box button. Once our button is ready we will hide out of box button. To implement our requirement use following steps

  • Download and install RibbonWorkBench solution
  • Create a Demo solution and add account entity to our solution.

Note: You can follow our previous post to get RibbonWorkBench solution, to create demo solution and adding existing entities. We are going to override Save button on account entity

Open Demo solution and add new web resource by navigating Components ->Web Resources -> New

  • Fill below properties and click on Text Editor button
    • Name: OnSave.js
    • Display Name: OnSave.js
    • Type: Script (Jscript)
  • At this point create a blank function like below

function OverrideSave()

{   //We will be changing it in later step   }

  • Save and Publish web resource

Now we will create a custom button and will copy properties or save button. Using following steps:

  • Open RibbonWorkBench and select our Demo solution
  • Drag Button from Toolbox and leave it next to Save under Form section
  • Right click on system Save button and select Customize Command
  • Use same properties of system Save button to our custom button except Sequence and CommandCore properties (we need to copy and paste these properties one by one)SaveButtons

Now we need to check command which is associated with system save button and need to see which function and parameter used for that. Follow below steps

  • Select Mscrm.SavePrimary under Commands and click on Actions lookup to check for function name and parameter, we got this command name from Save button commandcore property


  • Right click on Command and select Add New, we need to add command for your custom Save button
  • Click on Actions lookup -> click on Add and select JavaScript Function Action
  • Write our function name and select our web resource.
  • Click on Parameters lookup->click on Add and select Crm Parameter
  • Select Primary Control under Value drop down
  • It should look like below


  • Select our custom Save button and select our command name under command drop down
  • Right click on system Save button and select Hide Button option
  • Click on Publish button to publish your changes.
  • Open our java script web resource and change function definition like below

function OverrideSave()

{//Capture response

var response=confirm(“Do want to save ??”);


//system function


} }

  • Save and Publish web resource and open any account record.
  • Chang some field value and click on Save button you should get prompt like below


HIMBAP | Need any help in Microsoft CRM 2015 Contact US !!

1 Comment

Filed under MS CRM 2015