Archive for the ‘CRM 2013’ Category

Execute Custom Action using Late Binding – CRM 2013

Custom Actions provide the ability to write reusable modules of logic that can be triggered through client-side or server-side code.

Custom actions run synchronously and can take in parameters as well as return values.

In this article I will walk you through creation of a Custom Action with Input Parameters and execute the same using SDK call.

My Custom Action created on ‘Account’ entity and will do below actions

  • Takes a Input Parameter of type ‘Entity Reference’ to User, to set Owner of the Task to Accounts Owner
  • Create a new Task
Custom Action

Custom Action

  • Sets Owner of Task to Account’s Owner
Custom Action - Create Task

Custom Action – Create Task

  • Make sure you publish the ‘Custom Action’

Execute Custom Action :

  • We can execute Custom Action using Early or Late binding approach
  • For early binding we need to generate wrapper using exe tool by including ‘generateActions’ tag in console command.

CrmSvcUtil.exe /url:http://<serverName>/<organizationName>/XRMServices/2011/Organization.svc /out:<outputFilename>.cs /username:<username> /password:<password> /domain:<domainName> /namespace:<outputNamespace> /serviceContextName:<serviceContextName> /generateActions

  • Below is the code to execute using Late Bound technique

OrganizationRequest executeCreateTaskOnAccount = new OrganizationRequest(“new_CreateTaskOnAccount”);
// Set Account Owner EntityReference Input Parameter
Guid accountOwnerId={Account Owner GUID};
var accountOwner = new EntityReference(“systemuser”, accountOwnerId);
executeCreateTaskOnAccount.Parameters.Add(new KeyValuePair<string, object>(“AccountOwner”, accountOwner));

Few points :

  • Custom actions can be triggered using JScript and SDK calls
  • We cannot execute Custom Actions from a workflow
  • However you can create a Custom Workflow with ‘Custom Action’ execution logic and call from a Workflow
  • A security privilege named Activate Real-time Processes (prvActivateSynchronousWorkflow) is required to activate an action’s real-time workflow so that it can be executed


Categories: CRM 2013 Tags: , ,

Teams vs Access Teams vs Access Team Templates – CRM 2013

August 24, 2014 1 comment

As we know “Access Teams” are one of the new feature in CRM 2013.

Let’s see how this is different from Legacy Owner Team and finally how is it different from “Access Team Templates”.

Consider a scenario, Where we need to change the Accessibility of ‘Account’ records frequently

  • I have 3 Accounts in my system
  • Account 1 can be (Read/Write/Delete) only by User 1,User 2, User 3
  • Account 2 can be (Read/Write/Delete) only by User 4,User 5, User 6
  • Account 3 can be (Read/Write/Delete) only by User 6,User 7, User 8

We can achieve above requirement by below approaches.

Approach 1:

  • Create 3 teams with a Security role having Read, Write, Delete Privileges to Account
    • Team 1 (User 1,2,3), Team 2 (User 4,5,6), Team 3 (User 6,7,8)
  • Change the Ownership of Accounts to
    • Owner of Account 1 = Team 1; Account 2=Team 2 and Account 3 =Team 3
  • Or Share the Account records to Teams instead of Ownership.

Drawbacks of Approach 1 :

  • Sharing records to a Team with the same sets of users, with the same rights is a performance over head.
  • Add/remove users from team require CRM to reset the Cache and must be recreated by querying the SQL next time the user tries to perform any action.
  • We cannot show who all are working on the Account on the form (Only was is to open Share window and go to the Team to see the list of Users).

Approach 2:

  • Using Access Teams; Let’s see how it is different from old Team approach.

Access Teams :

  • In simple terms, Access Team is a kind of Team with no security role (i.e., No specific privileges at that time of Team creation)
  • Privileges are determined when you align the Access Team to a record via Sharing.
Share Access Team

Share Access Team

Access Team Templates :

  • We define a set of privileges while creating ‘Team Template’
Access Team Template

Access Team Template

  • Add a “Access Team” sub grid on the form. (How to create and add as Sub grid)
  • Add different Users to the “Access Team Sub Grid” for different Accounts. (i.e., User 1,2,3 for Account 1;User 4,5,6 for Account 2…).
Access Team Sub Grid On Account Form

Access Team Sub Grid On Account Form

Access Team vs Access Team Templates :

  • Underlying principle for both Access Team and Access Team Templates are same that No associate security role.
  • With ‘Access Team Templates’ privileges are pre-determined, but the people are not. With Access Teams, the people are pre-determined, but the privileges are not.

Team vs Access Teams :

  • Teams associated with a Security Role but not the case with Access Teams.
  • Records cannot be owned by Access Teams.
Access Teams Are Not For Ownersip

Access Teams Are Not For Ownership

  • You can create views or reports on Access Team Members but not with Teams.

Few more points :

  • Users have to have to Share privilege to add Users to “Access Team” sub grid.
  • We can have more than 1 Access Team sub grid on a form
  • The default number of access teams templates for each entity is two
  • The number of access team templates you can have for each entity is controlled by the MaxAutoCreatedAccessTeamsPerEntity deployment setting.
  • MaxEntitiesEnabledForAutoCreatedAccessTeams deployment setting has a default value of 5. This controls the number of entities it’s possible to enable for auto-created access teams.
  • We can change the MaxEntitiesEnabledForAutoCreatedAccessTeams , MaxAutoCreatedAccessTeamsPerEntity only on Premise installations and cannot edit them for Online.
  • To delete a Access Team Template, we need to remove all the associated ‘Access Team Template’ sub grids before.
  • A system generated Access Team isn’t created for each record until you add a user to the sub grid on the entity.
  • We can covert normal Teams to Access Teams.


Target CRM Version in Solutions – CRM 2013 Spring feature

With Spring update we got a new option “Target CRM Version” while exporting the solution.

Available options are 6.1 (default) and 6.0.

Target Solution CRM Version

Target Solution CRM Version

If you choose 6.0, any new capabilities of version 6.1 will not be included in the exported solution and any organizations still using version 6.0 will be able to install the solution.

All the removed or modified components will be listed out in a dialog.

Removed or Modified components

Removed or Modified components

Note – “Target CRM Version” option is unavailable if you export Default solution.

IntroducedVersion Property

  • In CRM 2013, solution component has an IntroducedVersion property.
  • This value captures the current product version number of the solution that the solution component was associated with when it was created.

Refer these links for more info


Categories: CRM 2013 Tags: ,

CRM Developer Toolkit for Visual Studio 2013

There is no release of CRM Developer Toolkit for VS 2013.

However by hacking the CRM Developer toolkit for VS 2012 we can get Developer Toolkit work for VS 2013.

Refer steps mentioned in this article.


Loading dependent jscript libraries in ribbon button’s execution CRM 2013

In CRM 2011, To load the dependent Jscripts on execution of ribbon button command actions

  • We can add the dependent script as a Library in the “Javascript Command” and pass “isNaN” as Function Name (Refer my existing article)

In CRM 2013, I observed a slight change in the execution w.r.t the order.

The dependent script files has to be ordered before the actual script file.

Dependent script file is not loading if the order of the file next to the actual script file.

Dependent JScripts Order

Dependent JScripts Order

In the above scenario there are 2 “Javascript Command” pointing to different web resources.

The “Javascript Command:isNaN” is my dependent script file hence I put that as 1st command.

Quick Create Forms – CRM 2013

‘Quick Create’ form is the latest addition in CRM 2013 new set of features.

‘Quick Create’ form enable you to create records quickly by just filling the key information (i.e., fields) using global ‘Create’ button.

Global Create Button

Global Create Button

In this article I would like to provide few key points about ‘Quick Create’ form

  • To enable ‘Quick create form’ for an entity, you have to check “Allow quick create” check box under Data Services in entity properties.
Allow Quick Create

Allow Quick Create

  • To create a new ‘Quick create form’, go to Entity -> Forms -> New -> Quick Create Form
Quick Create Form

Quick Create Form

  • Quick form only contain one Tab and three Section , we can’t add new tab or section.
Quick Create Form Design

Quick Create Form Design

  • Publish the Customizations.
  • Click on global ‘Create’ button on Navigation bar and select the entity and you get the form
Quick Create Form

Quick Create Form

‘Business Rules’ on Quick Create forms

  • ‘Business Rules’ work on ‘Quick Create Forms’
  • To enable ‘Business Rule’ to work on ‘Quick Create Form’, we just need to set the scope of ‘Business Rule’ to ‘All Forms’.
Business Rules Scope

Business Rules Scope

I will keep adding few more points, if I come to know.


CRM 2013 new form lay out and Notes control

February 23, 2014 Leave a comment

In CRM 2013 when you create a new entity and open ‘Main’ Customization form, it looks as below

Default CRM 2013 Layout

Default CRM 2013 Layout

It’s not how CRM 2011 form looks. In CRM 2011, you get separate ‘General’ and ‘Notes’ tabs

How to get back CRM 2013 form like CRM 2011 with separate General and Notes tabs

  • Double click ‘General’ tab and select ‘tab layout’ as ‘One column’
  • You get a warning as mentioned in below screen
Tab-One column

Tab-One column

  • Now you will get only ‘General’ tab and lose the ‘Notes‘ tab from the form.
  • So, to get back ‘Notes’ tab back
  • Add a new ‘One Column’ tab and select the tab
  • From the ribbon choose ‘Notes’ control
Notes Control

Notes Control

  • Now the ‘Notes’ tab will be back on the form
Form with Notes Control

Form with Notes Control

  • Now the end user form looks below
Offer Form

Offer Form

Notes Control

  • In CRM 2013, we can define the way how Notes, Activity Feeds and Activities are displayed on the form.
  • These three elements are now combined into a single control.
  • You just need to add the ‘Notes’ control on to the form and open properties and choose ‘Default’ tab (I.e., Activities o Posts or Notes)
Activities Tab Properties

Activities Tab Properties


Command bar – CRM 2013

February 18, 2014 Leave a comment

In CRM 2013, there is a major face-lift to the UI like no Navigation Bar, No conventional ribbons and introduction of ‘Command Bar’.

Below are few points about CRM 2013 Command Bar

  • The Ribbon Bar is still exists in CRM 2013, on non ‘refreshed’ entity Forms such as Connection Form and Price List Form, and is still present on all home list view grids in Outlook client.
  • Command Bar shows 5 controls at any one time before they are added to the ‘overflow’ section.
  • Command Bar does not display ‘Disabled’ controls instead they will come in ‘overflow’ section.
Command Bar

Command Bar

CommandClientTypeRule Display Rule

  • There is a new display rule CommandClientTypeRule determines the visibility of a control on the command bar.
  • Controls will be displayed on the Command Bar, if
    • Associated Command has no CommandClientTypeRule Display Rules
    • If it has a CommandClientTypeRule with Type=Refresh
  • ‘Type’ property has the following values:
    • Modern – Control is visible in the Tablet client
    • Refresh –  Control is visible in the Command Bar
    • Legacy   –  Control is visible on ribbons of non-refresh entities or in list views presented in Microsoft Outlook.


Duplicate detection functionality in CRM 2013

In CRM 2013, Duplicate record detection feature on create/update form has been removed due to the ‘Auto Save‘ functionality, which saves the form frequently.

Below are the 2 ways we can bring back the functionality.

Solution provided in CRM 2013 SDK 

  • In SDK there is a recommend approach to enable the duplicate detection feature on a required entity Create\Update form.
  • Download the CRM 2013 SDK, navigate toSDK\SampleCode\JS\DuplicateDetection\ReadMe.docx” document to get more information.
  • Here is an useful article with screen shots on the same.

Note –

  • We might need to disable your ‘autosave’, otherwise ‘autosave’ keeps triggering the duplicate detection
  • Refer this article how to skip autosave on onload or onsave.

CRM 2013 Duplicate Detection tool codeplex

  • There is a solution on codeplex which gives you the duplication detection functionality.
  • Download


New JScript syntaxes – CRM 2013

With the advent of CRM 2013, below are the new set of client API methods

CRM 2013 Client API

CRM 2013 Client API


  • Xrm.Page.context.getUserName() Returns username of the currently logon user
  • Xrm.Page.context.getClient() Returns the client (i.e., Returns “Outlook”, “Web”, or “Mobile”)
  • Xrm.Page.context.client.getClientState()Returns  whether user is working online or offline.

Note – Xrm.Page.context.isOutlookOnline and isOutlookClient methods are deprecated


  • refresh data on form without reloading the page
  •, errorCallback) Allows you to save the record asynchronously with the option to set callback functions to be executed after the save operation is completed.
  • Validates the form and returns a Boolean.
  • – Allows to set IsDirty options on the form to (true/false).


  • Returns a string value of the primary attribute for the entity.


  • Xrm.Utility.openWebResourceDialog(webResourceName,webResourceData,width,height) Displays html web resource as dialogs window.
  • Xrm.Utility.alertDialog(message,onCloseCallback) Displays alert box with a callback function.
  • Xrm.Utility.confirmDialog(message,yesCloseCallback,noCloseCallback) Displays confirm dialog with different callbacks depending on Yes/No button clicks.

 Set Notifications

  • Check this link for syntaxes

Number Fields

  •      Xrm.Page.ui.controls.get(controlName).setPrecision(2) – Overrides field’s precision

Date Fields

  •    Xrm.Page.ui.controls.get(controlName).setShowTime(true) Controls whether to show the time for a date field.
  •    Xrm.Page.ui.controls.get(controlName).setIsAllDay()Allows to set the date control to all day date time.

Look up Fields

  •    Xrm.Page.ui.controls.get(controlName).addCustomFilter(filter,entityLogicaName)
    •    Applies a custom filter to the lookup view
    •    entityType is optional and if it is not passed it will default to all entity views
  •    Xrm.Page.ui.controls.get(controlName).addPreSearch(handler)Allows to add additional logic that will occur just before the search dialog box
  •   Xrm.Page.ui.controls.get(controlName).removePreSearch(handler)Removes event handler functions that previously been set in addPreSearch event.


Categories: CRM 2013 Tags: ,