Category Archives: MS CRM 2013

Get Comment from user before de-activating entity record

Requirement : While deactivating account record, we need to get deactivation comments from user before deactivating account.

Solution: We can implement this requirement using different ways, in this post we are going to provide out of the box solution for this requirement. We can achieve this using dialog, if you are new to dialogs I suggest you to refer https://msdn.microsoft.com/en-us/library/gg509010.aspx first, where you can learn about dialogs and their component.

Idea here is hide the out of the box deactivate button for account entity and then design a dialog with prompt and response, we can ask user to enter comments and then we can update account entity description field (or you can setup your own custom field) with the comments, after that we can deactivate account record. Using following steps to design our dialog:

  • Navigate to Settings -> Processes and select New button through process command bar
  • Enter process name for example “Deactivate Account
  • Select category as “Dialog” and select Account under entity drop down
  • Click on Add Step and select Page from drop down to add a page in dialog

dialog1

  • Select line under page and again click on Add Step and add a Prompt and Response.
  • Click on Set Properties button and set properties like below :

dialog2

  • Click on Save and Close and select Page area and then add Update from Add Step dropdown, now we will update account record.
  • Click on Set Properties, Select description field in account form and select Look For like below and first click on Add and then on Ok, so that comment will store in description field.

dialog3

  • Now finally add Change Status step from Add Step dropdown and set status to Inactive
  • Our dialog steps should look like below:

dialog4

  • Activate our dialog using Activate button on dialog command bar

Testing Dialog:

To test our dialog, now simply navigate to Sales->Accounts and select and account and click on Start Dialog button under more commands (…), it will display our dialog name, select our dialog and click on Add, it will ask for comment like below:

dialog6

Click on Next button after entering comments and finish it, it will store out comment in account record and will activate account, and you check your account record under Inactive view.

We can simply hide our of the box deactivate button using RibbonWorkbench tool, you can refer our post, for how to hide system buttons.

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

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:

Xrm.Page.getControl(‘address1_composite_compositionLinkControl_address1_city’).setLabel(“District”);

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()

{

Xrm.Page.getControl(‘address1_composite_compositionLinkControl_address1_city’).setLabel(“District”);

}

accountform

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

addressfield

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

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:

first

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

second

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:

found

  • 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

Fixing “Description name must be specified Parameter name: description” Error

We may get this error while deploying workflow assembly using Developers toolkit if we missed to fill description field while adding new Workflow Activity Class.

2015-02-22_12-29-51

We can fix this error using following steps:

  • Navigate to workflow project properties (Right Click on workflow project ->Select Properties)
  • Select Application tab and click on Assembly Information button
  • Fill information under Description field
  • Build try to Deploy your solution again

2015-02-22_12-36-14

But we may still get this error if RegisterFile.crmregister file is not updated automatically, so we may need to update this file manually by adding Description property like below, now we should be able to deploy our workflow solution without any issue.

2015-02-22_12-54-31

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

Leave a comment

Filed under MS CRM 2013

Creating html web resource to show image attached in Notes Part 2

In our previous post we explained how we can get image from notes using OData endpoints, in this post we are going to explain how we can create html web resource and use our java script method to get and display image. We need to implement two steps:

  •   Create html page
  •   Deploy html page and SDK.REST.js using web resource

Create html page

Create html page using any html editor, use following code for html page

<html lang=”en-us”><head>
<script src=”../ClientGlobalContext.js.aspx”></script>
<script type=”text/javascript” src=”SDK.REST.js”></script>
<script type=”text/javascript”>
//check if document is loaded or not
var imgControl = document.createElement(“IMG”);
//Check if documented loaded fully
document.onreadystatechange = function () {
if (document.readyState == “complete”) {
getnotesImages();
}
}
//this function is used to get image from notes
function getnotesImages()
{ //get regarding object id
var regardingObjectId=window.parent.Xrm.Page.data.entity.getId();
//assign notes entity name
var entitySchemaName=”Annotation”;
var odataQuery = “?$top=1&$select=AnnotationId,DocumentBody,MimeType&” +
“$filter=ObjectId/Id eq guid'” + regardingObjectId +
“‘ and IsDocument eq true and startswith(MimeType,’image/’) “;
//call retrieveMultipleRecords method in SDK.REST javascript script library
SDK.REST.retrieveMultipleRecords(entitySchemaName, odataQuery, getnotesImagesCallback, function (error) { alert(error.message); }, function(){});
}
//process callbanck result
function getnotesImagesCallback(resultSet)
{
if (resultSet.length > 0) {
var mimeType = resultSet[0].MimeType;
var body = resultSet[0].DocumentBody;
imgControl.src=”data:” + mimeType + “;base64,” + body;
document.getElementById(‘imagediv’).appendChild(imgControl);
}
}
</script>
<meta charset=”utf-8″></head><body style=”zoom: 1;”>
<div style=”width: 100px;” id=”imagediv”></div>
</body></html>

Deploy html page and SDK.REST library using web resource

Using following steps to deploy html page and SDK.REST library in MS CRM.

  •       Navigate to Settings -> Customization-> Customize the System from top navigation bar
  •       Navigate to Components -> Web Resources-> New
  •       Fill details like following screen

saveimg

  • Click on browse button and select your html web resource.
  •        Click on Save and then Publish
  •        Navigate to Components -> Web Resources-> New
  •        Fill details like following screen

sdk.rest

  • Click on browse and select SDK.REST.js from MS CRM SDK

Note: Please refer previous post for SDK.REST.js location.

Now we can place our html web resource in the account entity form by navigating Insert  -> Web Resource options. Save your changes and then publish account entity form.

form

When you will try to open your account record you should be able to see attached images loaded into html web resource.

img

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

2 Comments

Filed under MS CRM 2011, MS CRM 2013, MS CRM 2013 Web Resource, MS CRM 2015

Creating html web resource to show image attached in Notes Part 1

Microsoft Dynamics CRM 2013 introduced new entity image feature, so we can have one image attribute and can use that to store entity image. But we can have only one image attribute per entity. So in this article we are going to demonstrate how we can build an image slider using the java script.

Microsoft Dynamics CRM store all the notes and attachment in annotation entity. Most of the out of box entity used to have relationship with this entity, but while creating our custom entity we can specifically select if we want to associate our custom entity with notes or not using following option under Communication & Collaboration. Keep in mind once you enable this option, there is not supported way to disable this option, but if you are not sure, if you need notes or not at the time of your entity creation better to leave this option un-selected, so that you can select this option after sometime if required.

notesoption

Note: The default size for notes attachment is 5 MB but if required you can increase this limit up to 32 MB.

For our demo purpose we are going to use account entity which already have relationship with notes entity. We will utilize attachment feature to attach image and use that in our html web resource for display. So basically we are going to implement below steps

  •     Get entity image from notes
  •     Create and deploy html web resource.

Get entity image from notes

We can attach image in notes using social pane in Microsoft Dynamics CRM 2015, like following screen.

attachimage

Once image is attached to notes, we can retrieve it using OData or Soap endpoint, we are going to use OData endpoints in this article. To retrieve data from notes we need to query annotation entity based on ObjectId field, that we can get entity id using getId method. We need to write retrieve multiple call to get image record, we can use SDK.REST.js java script library that comes with MS CRM SDK and call it’s retrieveMultipleRecords method to get data based our query. Please download MS CRM SDK to get details about this library and it’s method.

function getnotesImages()
{ //get regarding object id
var regardingObjectId=window.parent.Xrm.Page.data.entity.getId();
//assign notes entity name
var entitySchemaName=”Annotation”;
var odataQuery = “?$top=1&$select=AnnotationId,DocumentBody,MimeType&” +
“$filter=ObjectId/Id eq guid'” + regardingObjectId +
“‘ and IsDocument eq true and startswith(MimeType,’image/’) “;
//call retrieveMultipleRecords method in SDK.REST javascript script library
SDK.REST.retrieveMultipleRecords(entitySchemaName, odataQuery, getnotesImagesCallback, function (error) { alert(error.message); }, function(){});
}
//process callbanck result
function getnotesImagesCallback(resultSet)
{
if (resultSet.length > 0) {
var mimeType = resultSet[0].MimeType;
var body = resultSet[0].DocumentBody;
imgControl.src=”data:” + mimeType + “;base64,” + body;
document.getElementById(‘imagediv’).appendChild(imgControl);
}}

Note: You can download latest CRM SDK from here and find SDK.REST.js under SDK\SampleCode\JS\RESTEndpoint\JavaScriptRESTDataOperations\JavaScriptRESTDataOperations\Scripts.

Stay tuned for our next post to create and deploy html web resource using above method to get and display image.

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

Leave a comment

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

Using Routing Rule Set in Microsoft Dynamics CRM 2013

Microsoft Dynamics CRM 2013 SP1 and Microsoft Dynamics CRM Online Spring ’14 introduced a new feature that allows us to define case routing rules. We can set up different queues based on different business scenarios and then define case routing rules to route cases to these queues (Note: we can have only one routing rule set active at a time). To define routing rules we can navigate to Settings -> Service Management.

Any user with appropriate permission on Routing Rule Set can create and modify routing rules.

ruouting security rule

In our scenario let say we have queues named High Priority and Low Priority (we can create new queue by navigating Settings ->Service Management->Queues) and we want to define a routing rules to rout high/low priority cases to respective queues. To create routing rule, we need to use following instructions:

  • Navigate to Settings-> Service Management-> Routing Rule Set->New
  • Fill routing rule set name, Let’s say “Case Assignment Rule
  • Click on Save button under command bar
  • Click on plus sign on Rule Item sub grid to create rule
  • Define routing rule like following screen and click on Save and Close on rule item window.

ruletitem

  • Follow same steps to create another Rule Item to check if case priority equals to low then assign case to Low Priority queue.
  • Click on Activate button on command bar of routing rule set from.

Now navigate to active case view and select single or multiple cases. After selection, we will see APPLY ROUTING RULE button on command bar, click on this button and it will rout cases based on their priority to high or low priority queue.

case routingNow navigate to Service -> Queue, we should be able to see all cases routed to respective queses.

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

2 Comments

Filed under MS CRM 2013

Capture old value before change in Microsoft Dynamics CRM 2013 using Real Time Workflow

While working on opportunity, we want to monitor closely all the changes happening in opportunity, for example when Probability value has changed, when opportunity rating is changed etc, maybe we also want to notify the sales manager about these changes with details. Let’s use an example of Opportunity rating, OOB opportunity rating field contains three options:

  • Hot
  • Warm
  • Cold

We can also modify this field if required to fulfill business requirement, so let say when opportunity rating is changed we want to notify our company sales manager with the following very simple information:

Rating for Opportunity has been updated

Previous Rating : <<Old Rating>>

New Rating : <<New Rating>>

We can simply set up an asyn workflow to send notification on changes of rating, but to capture old value of the rating, we need to create a custom field to hold this value for us and create a real time workflow to get old value form rating field. Following are the steps to complete this requirement.

Let’s first create custom field in opportunity entity

  • Browse MS CRM 2013 Application and navigate to Settings
  • Navigate to Customization | Customize the System
  • Navigate to Components | Opportunity |Fields | New
  • Create a field text field for old rating
  • Place this field over Opportunity form.
  • Save and Publish your changes

Let’s now setup our asyn workflow to send notification. Following are the steps to create asyn workflow

  • Navigate to Settings | Processes | New
  • Use following properties
    • Process Name: Send Notification
    • Category: Workflow
    • Entity: Opportunity
    • Make sure “Run this workflow in the background (recommended)” is selected
  • Configure to run workflow as Child (select “As a child process”)
  • Click on Add Step and select Send email option from drop down
  • Click on Set Properties and configure your email like following

emailPropertiesYou need to get Rating and old rating value from Form Assistant like above. Finally your workflow should look like belowfinalworkflow

  • Activate your process.

Now let’s setup a Real time workflow to capture old value before change. Following are the steps to setup workflow

  • Navigate to Settings | Processes| New
  • Navigate to Settings | Processes| New
  • Use following properties
    • Process Name: Capture Old Value
    • Category: Workflow
    • Entity: Opportunity
    • Make sure to uncheck “Run this workflow in the background (Recommended)” option
  • Click Ok
  • Configure your Syn workflow using following properties
    • Scope: Organization
    • Start when: Before
    • Record fields changes: Check this (select rating field using Select button)
  • Click on Add Step and select Update option
  • Click on Set Properties and set old rating field like following screen

updaterating

  • Click on Save and Close
  • Click on Add Step and select Start child workflow
  • Select your workflow that is created in earlier step
  • Finally it should look like following

finalrealworkflow

  • Activate your workflow

Open any opportunity record and try to change rating value then hit Save, you should be able to see old rating value in old rating field.

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

Leave a comment

Filed under MS CRM 2013

Creating RSS Feed Dashboard in Microsoft Dynamics CRM 2013: Part 3

This is our last post to create a RSS feed dashboard in Microsoft Dynamics CRM 2013. Please check our previous posts to create a RSS feed web resource for Microsoft Dynamics CRM Team blog and Twitter user account. In this post we will use these web resources in our dashboard.

Please follow our previous post to get RSS feeds and create web resources for the following URLs.

Once we have all the web resources ready, use the following procedure to create a RSS feed dashboard:

  • Navigate to Settings |Customization | Customize the System.
  • Navigate to Components | Dashboard | New.
  • Select “2-Column Regular Dashboard” from the layout and click on Create.
  • Fill in “Microsoft Dynamics CRM RSS Feeds” under the name TextBox.
  • Please your web resources in the dashboard columns and provide a display name.
  • After placing the web resources it should look like the following screen.

dashboard

  • Save your dashboard and navigate to the Microsoft Dynamics CRM 2013 home page.
  • Select Microsoft Dynamics CRM RSS Feeds dashboard from the drop down.

Our dashboard will look like the following:

firnaldashboard

Stay tuned for our next article.

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

2 Comments

Filed under JS Script, MS CRM 2013

Creating RSS Feed Dashboard in Microsoft Dynamics CRM 2013: Part 2

This is our second post to create RSS feed dashboard. In our previous post we explained how to create web resource to display website RSS feeds. In this post we will provide procedure to create Twitter feed web resource.

We can get Twitter RSS feeds using URL like http://twitrss.me/twitter_user_to_rss/?user=username , where for username parameter we can use our Twitter user account, so for example for HIMBAP, we need to use following URL

http://twitrss.me/twitter_user_to_rss/?user=himbapinfo

So we can go to http://feed.mikle.com/  and follow steps from previous blog to create widget and get code.

Twitter itself also provide source code to create widget so we don’t need to use any other free widget, we can simply connect to our twitter account and can get source code from there for widget. Following are the steps to create twitter feed web resource

  • Connect to your twitter account (we are using our HIMBAP twitter account)
  • Navigate to Settings under Profile and Settings
  • Select Widgets and click on Edit

himbapinfo

  • Copy twitter widget code

copycode

  • Browse Microsoft Dynamics CRM 2013 Application
  • Navigate Settings | Customizations | Customize the System
  • Click Newunder Components | Web Resources
  • Fill following properties
    • Name: <<Provide meaningful name>>.html
    • Display Name : <<Provide meaningful name>>.html
    • Type: Webpages(HTML)
  • Click on Text Editor and past the code that we copied from twitter account
  • Save and Publish your changes
  • Click on Preview you should be able to see our twitter account RSS feeds like belowhimnews

Stay tuned, in next post we show how to use these web resources in Dashboard.

HIMBAP | Need any help in MS CRM 2013 Contact US !!

1 Comment

Filed under MS CRM 2013