Category Archives: Step By Step MS CRM 2011

Step by Step creating Quick Entity View in MS CRM 2011

During one of our projects we got a requirement to show related entity fields, based on the lookup selection, just like the Quick Entity View feature that we have in Microsoft CRM 2013, so I thought of replicating that for Microsoft CRM 2011. In this article I am sharing code and how to do that so that it can help someone with similar requirements.

Let’s say we want to show contact fields in an account entity form based on the primary lookup selection. To implement this requirement we can use a HTML web resource and use the rest of the endpoints to get contact data based on the contact id selected. So mainly we have the following three steps:

  • Create HTML web resource to get data from child entity and create a html table on the fly.
  • Add HTML web resource in the parent entity form.
  • Create an onchange handler to refresh a HTML web resource when the lookup value is changed.

So let’s create a HTML web resource and name it “/ContactQuickView.html” as in the following.

htmlwebresource

Click on Text Editor and paste below code:-

<html lang=”en-us”><head>
<title>Contact Quick View</title>
<style type=”text/css”>
body
{
font-family: segoe ui;
background-color: #F6F8FA;
}
table
{border-spacing:8px;
width=”100%”;
}
td  { width: 130px;
background-color: #F6F8FA;
font-size: 13px;
}
</style>
<script src=”../ClientGlobalContext.js.aspx”></script>
<script type=”text/javascript”>
//check if document is loaded or not
document.onreadystatechange = function () {
if (document.readyState == “complete”) {
parseEntityID();    }  }
function parseEntityID() {
var queryParam = GetGlobalContext().getQueryStringParameters().data;
var fields = queryParam.split(“,”);
var TabName=fields[1];
var SectionName=fields[2];
if ((window.parent.Xrm.Page.data.entity.attributes.get(fields[0])!= null) && (window.parent.Xrm.Page.data.entity.attributes.get(fields[0]).getValue()!=null))  {
var ContactID = window.parent.Xrm.Page.data.entity.attributes.get(fields[0]).getValue()[0].id;
//change tab and section name here
window.parent.Xrm.Page.ui.tabs.get(TabName).sections.get(SectionName).setVisible(true);
RetrieveContactRecord(ContactID);    }
else
{   window.parent.Xrm.Page.ui.tabs.get(TabName).sections.get(SectionName).setVisible(false);   }  }
//Read contact information
function RetrieveContactRecord(id) {
var ServerURL=window.parent.Xrm.Page.context.getClientUrl();
var ServiceURL=ServerURL+”/xrmservices/2011/organizationdata.svc”;
var req = new XMLHttpRequest();
req.open(“GET”, ServiceURL + “/Contact” + “Set(guid'” + id + “‘)”, true);
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 200) {   successCallback(JSON.parse(this.responseText).d);                }
else {  alert(‘Error while reading contact information’);  }  }
};
req.send();     }
//Added for cross browser support.
function setText(element, text) {
if (typeof element.innerText != “undefined”) {
element.innerText = text;
}
else {  element.textContent = text;    }  }
//Generate html table to show records
function successCallback(ResultSet)
{
//store lables
var lbs=new Array();
lbs[0]=”Business Phone”;
lbs[1]=”Email”;
lbs[2]=”City”;
lbs[3]=”ZIP/Postal Code”;
lbs[4]=”State/Province”;
lbs[5]=”Country/Region”;

//store values
var vals=new Array();
vals[0]=(ResultSet.Telephone1!=null)?ResultSet.Telephone1:” “;
vals[1]=(ResultSet.EMailAddress1!=null)?ResultSet.EMailAddress1:” “;
vals[2]=(ResultSet.Address1_City!=null)?ResultSet.Address1_City:” “;
vals[3]=(ResultSet.Address1_PostalCode!=null)?ResultSet.Address1_PostalCode:” “;
vals[4]=(ResultSet.Address1_StateOrProvince!=null)?ResultSet.Address1_StateOrProvince:” “;
vals[5]=(ResultSet.Address1_Country!=null)?ResultSet.Address1_Country:” “;

//Create a table and header using the DOM
var oTable = document.createElement(“table”);
var oTBody = document.createElement(“tbody”);

for(var i=0; i<6; i++)
{
var oTRow = document.createElement(“tr”);
var oTRowBlank = document.createElement(“td”);
var oTRowTDBlank1= document.createElement(“td”);
var oTRowTDBlank2= document.createElement(“td”);
j=i;
var oTRowTD1 = document.createElement(“td”);
oTRowTD1.style.color=’003DB2′;
setText(oTRowTD1, lbs[i]);
var oTRowTD2 = document.createElement(“td”);
setText(oTRowTD2, vals[j]);
oTRow.appendChild(oTRowTD1);
oTRow.appendChild(oTRowTD2);
oTRow.appendChild(oTRowBlank);
oTRow.appendChild(oTRowTDBlank2);

if(i+1<lbs.length)
{
var oTRowTD3 = document.createElement(“td”);
oTRowTD3.style.color=’003DB2′;
setText(oTRowTD3, lbs[i+1]);
var oTRowTD4 = document.createElement(“td”);
setText(oTRowTD4, vals[j+1]);
oTRow.appendChild(oTRowTD3);
oTRow.appendChild(oTRowTD4);
oTRow.appendChild(oTRowTDBlank1);
}
i++;
oTBody.appendChild(oTRow);
}
oTable.appendChild(oTBody);
document.body.appendChild(oTable);   }
</script>
<meta charset=”utf-8″></head><body>
</body></html>

Note: Please make sure to change quotations sign if you are copying code.

Now we have html web resource ready, place it under the parent entity form, while placing web resource we need to pass three parameters:

  • Name of the lookup field for child entity.
  • Name of the tab and section where we have placed web resource like below

htmlwebresourceparameter

Now we need to create a JS webresource and need to use below code. We have to call this function on primary contact  lookup field onchange on account entity form to refresh web resource once value will be changed.
function reloadTerrtoryQuickView()

{ var wrControl = Xrm.Page.ui.controls.get(“WebResource_TerritoryQuickView”);

wrControl.setSrc(wrControl.getSrc()); }

And once we will open account form it will show related information based on the primary contact selected like below

contactviewImageEnjoy !!!

Advertisement

Leave a comment

Filed under MS CRM 2011, Step By Step MS CRM 2011

Step by Step Using “DecrementBy” in Microsoft Dynamics CRM 2011 Workflow

Did you ever get a requirement to decrease your product’s quantity on hand value by 1 using OOB workflow ? We found one post in Microsoft Development Forum and thought of writing this blog post so that it can help other CRM folks. Let’s say we are using case entity and when a case is resolved we need to decrement value 1 from quantity on hand field in associated product, you can follow below step by step instruction to implement this requirement.

Step1. Setup a product with some value in Quantity on hand field like below

Step2. Create a workflow to decrement value from Quantity on hand field, navigate to Settings->Process->New.

Step3. Select workflow properties (Entity ->Case) and select Ok.

Step4. Select “Record status changes” option under start when.

Step5. Add a check condition (Navigate to Add Step->Check Condition) like below and click on Save and Close.

checkcondition

Step6. Add a step to update product entity and click on Set Properties.

Step7. Select Quantity On Hand field and perform steps in sequence like below screen.

steps

After this your workflow designer should look like below

workflowdesigner

Step8. Activate your workflow and close it.

Once you will resolve a case which has product associated with it, it will decrement value 1 from quantity on hand field.

HIMBAP | Need any help in customization Contact US !!

Leave a comment

Filed under MS CRM 2011, Step By Step MS CRM 2011

Step By Step Hiding Ribbon Button in MS CRM 2011 Part2

In our last post we explained how we can hide ribbon button on MS CRM 2011 entity form manually by modifying ribbon xml, in this post we are going to explain how this can be implemented using ribbon editors addon available in market.

We are going to use Ribbon Workbench for CRM 2011 for this demo, so let’s start:

Step1: Create new solution and add your entity in that.

Step2: Download Ribbon Workbench for CRM 2011 from http://ribbonworkbench.uservoice.com/knowledgebase/articles/80806-download-ribbon-workbench-for-crm-2011

Step3: Navigate to Settings->Solutions->Import and Import this solution in your MS CRM 2011 organization.

WorkBench

Step4: Double click on Solution after it is imported.

Step5: It will ask you to select your solution, select solution that you have created in Step1.

Step6: Select Form from dropdown box.

2013-05-28_113601

Step7: Right Click on button that you want to hide (we are hiding Save & New)

2013-05-28_113922

Step8: Publish your changes.

Now you should not be able to see this button in lead entity form.

Himbap | Need any help in customization Contact US !!

3 Comments

Filed under MS CRM 2011, Step By Step MS CRM 2011

Step By Step Creating Custom Workflow in Microsoft CRM 2011- Part2

In previous post we started creating custom workflow to get lead created day and assign all lead created on Sunday to Alan, we have completed code to get lead created day, so let’s now write function to get user id for Alan and assign all lead to Alan if lead created day is Sunday.

13. Create function to get userid like below

private Guid GetUserID(IOrganizationService service) //function to get userid

{  Guid _UserID = Guid.Empty;

ConditionExpression condition1 = new ConditionExpression();

condition1.AttributeName = “firstname”;

condition1.Operator = ConditionOperator.Equal;

condition1.Values.Add(“Alan”);

ConditionExpression condition2 = new ConditionExpression();

condition2.AttributeName = “lastname”;

condition2.Operator = ConditionOperator.Equal;

condition2.Values.Add(“Smith”);

FilterExpression filter1 = new FilterExpression();

filter1.Conditions.AddRange(condition1,condition2);

QueryExpression query = new QueryExpression(“systemuser”);

query.Criteria.AddFilter(filter1);

EntityCollection EntityCol = service.RetrieveMultiple(query);

if (EntityCol.Entities.Count > 0)

{    Entity _User = (Entity)EntityCol.Entities.FirstOrDefault();

_UserID = _User.Id;

}

return _UserID;

}

14. Write a function to assign passed lead to Alan, like below

private void Assignlead(IOrganizationService service,Guid LeadID,Guid UserID)

{

AssignRequest _Assign = new AssignRequest() {

Assignee=new EntityReference(“systemuser”,UserID),

Target =new EntityReference(“lead”, LeadID)

};

service.Execute(_Assign);

}

finally we need to modify our Execute method and add below lines

if(Day==”Sunday”)

{           Guid _UserID= GetUserID(service);

Assignlead(service,context.PrimaryEntityId,_UserID);

}

Our code is complete now, build your assembly and register it using plugin registration tool. While registering we can configure our step and workflow group name like below screen. Save your changes after providing these details.

providedetails

15. Now create a workflow on lead and set it to run when “Record is created”.

16. Click on Add Step and you should be able to see your custom workflow there.

Groupname

17. Select your assembly step to initialize your variables.

firststep

18. Add an update step to update lead record and click on set properties.

19. Selected your custom field (“Created Day”) and select your assembly name from Look For drop down under form assistance.

SaveArgument

20. Assign your output variable to your custom field by clicking on Add and Ok.

Save and Activity your process, now test your workflow.

Enjoy !!!

Note: if you are copying record please make sure to change Quotes marks.

11 Comments

Filed under MS CRM 2011, Step By Step MS CRM 2011

Step By Step Creating Custom Workflow in Microsoft CRM 2011

If you are a fresher in Microsoft CRM 2011 development and want to learn how to write custom workflow for Microsoft CRM 2011, then this post is for you. Let’s consider one scenario Company Xrm used to get many leads on weekend, but none of their existing sales executive wants to work on weekend, so they have recently recruited one part time sales person Alan who will be working on weekends. So we have a requirement to assign all the leads created during weekends to Alan and we also need to display Created Day in lead records. So keeping this scenario in mind, we have to requirement.

  1. Find out name of the day when lead is created and set it for Created Day.
  2. Assign all the leads created during weekend to Alan.

So let’s follow step by step to implement our requirement.

  1. Modify lead entity and add a new field let’s say “Created Day” of type Text and publish your changes.
  2. Once we have customized lead entity let’s create custom workflow assembly to find name of the day when lead is created.
  3. Start Visual Studio and select New Project->Workflow->Activity Library
  4. Delete “Activity1.xaml” file.
  5. Right Click on project and select Add New->add a class and name it “LeadAssignment.cs”
  6. Right Click on project -> select properties and make sure Target Framework is “.Net Framework 4” under Application tab.
  7. Sign your assembly.
  8. Right Click on project and select Add Reference to add required assemblies to our project.

We need to add below Microsoft CRM 2011 SDK assemblies and .net assemblies

Microsoft.xrm.sdk

Microsoft.xrm.sdk.workflow

Microsoft.crm.sdk.proxy

System.Runtime.Serialization

9. Double click on “LeadAssignment.cs” and add below using directive to your class.

using Microsoft.Xrm.Sdk.Query;

using System.Activities;

using Microsoft.Xrm.Sdk.Workflow;

using Microsoft.Xrm.Sdk;

using Microsoft.Crm.Sdk.Messages;

10. Modify your class definition like below to inherit

class LeadAssignment:CodeActivity

11. Declare output variable of string type and declare it’s property like below

[Output(“DayofWeek”)]

public OutArgument<String> DayofWeek { get; set; }

//output variables are used to provide response to user when user will select this attribute from form assistant

12. Now add below execute method to our class

protected override void Execute(CodeActivityContext Execution)

{

string Day = string.Empty;

DateTime _Date = DateTime.MinValue;

//get context

IWorkflowContext context = Execution.GetExtension<IWorkflowContext>();

//create iorganization service object

IOrganizationServiceFactory serviceFactory =

Execution.GetExtension<IOrganizationServiceFactory>();

IOrganizationService service =

serviceFactory.CreateOrganizationService(context.InitiatingUserId);

//get created date of the lead

Entity _lead = (Entity)service.

Retrieve(“lead”, context.PrimaryEntityId, new ColumnSet(

new string[] { “createdon” }));

if (_lead.Contains(“createdon”))

{

//get day of the week based on created on date

Day = ((DateTime)_lead.Attributes[“createdon”]).DayOfWeek.ToString();

}

//set value to output variable

DayofWeek.Set(Execution, Day);

}

In next post I will show how we can assign lead to Alan.

Enjoy !!!

Note: if you are going to copy above code, please make sure to change quotes.

Step By Step Creating Custom Workflow in Microsoft CRM 2011- Part2

3 Comments

Filed under MS CRM 2011, Step By Step MS CRM 2011

Adding Attach File button on Custom Activity Type Entity

MS CRM 2011 introduced a new feature to create custom activity type entity. While creating custom activity type entity, even if we will enable Notes (include attachments), we won’t get Attach File button just like we used to get in any custom entity where Notes is enabled. So what if you want to get that button?? you just need to follow this post 🙂

To create custom Attach File button we need

  1. A Webresource to form notes URL.
  2. We need Attach File image to show it in custom Ribbon button.
  3. We need to create custom Ribbon Button.

 Let’s first create webresource to open notes dialog.

Let’s first create a solution and add our custom activity to that solution. Once entity is added create a new web resource let’s say Notes.js and add below function to that webresourc

function FileAttachment()

{

var EntityID =Xrm.Page.data.entity.getId(); // to get entity id

var ServicerURL=Xrm.Page.context.getServerUrl(); // to get server url

var NotesURL=ServicerURL+”/notes/edit.aspx?hideDesc=1&pId=”+ EntityID +”&pType=”;

var etc = Xrm.Page.context.getQueryStringParameters().etc; // to get entity type code, make sure not to hard code it, because it could changed in another deployment

var features = ‘copyhistory=no,top=110,left=280,width=600,height=30’;

openStdWin(NotesURL +etc,””,features);

}

Save and close webresourc and publish it.

Let’s create a .png  image webresource to store image for attachment ribbon button. Follow below steps to create image webresource

  1. Navigate to Solution->Webresourc and click New
  2. Enter below information
  • Name: AddAttachment_16.png
  • Display Name: AddAttachment_16
  • Type: PNG format
  • Language: English

** we need to upload attachment_16.png, You can find this image for attachment in sdk\resources\images\ribbon folder.

we need to follow same steps to create webresourc for attachment_32.png image.

Now we have our web resources ready so let’s create our custom ribbon button. Export solution as unmanaged state and unzip solution. We need to edit customization.xml file in visual studio and add below code for Ribbon definition:

  <RibbonDiffXml>

        <CustomActions>

          <CustomAction Id=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.CustomAction” Location=”Mscrm.Form.new_CustomActivity.MainTab.Actions.Controls._children” Sequence=”41″>

            <CommandUIDefinition>

              <Button Id=”MyDemo.Form.new_CustomActivity.MainTab.Actions.attachment” Command=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.Command” Sequence=”29″ ToolTipTitle=”$LocLabels:MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.LabelText” LabelText=”$LocLabels:MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.LabelText” ToolTipDescription=”$LocLabels:MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.Description” TemplateAlias=”o1″ Image16by16=”$webresource:MyDemo_Attachment_16.png” Image32by32=”$webresource:MyDemo_Attachment_32.png” />

            </CommandUIDefinition>

          </CustomAction>

        </CustomActions>

        <Templates>

          <RibbonTemplates Id=”Mscrm.Templates”></RibbonTemplates>

        </Templates>

        <CommandDefinitions>

          <CommandDefinition Id=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.Command”>

            <EnableRules>

              <EnableRule Id=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.Command.EnableRule.FormStateRule” />

            </EnableRules>

            <DisplayRules />

            <Actions>

              <JavaScriptFunction FunctionName=”FileAttachment” Library=”$webresource:MyDemo_Attachment.js” />

            </Actions>

          </CommandDefinition>

        </CommandDefinitions>

        <RuleDefinitions>

          <TabDisplayRules />

          <DisplayRules />

          <EnableRules>

            <EnableRule Id=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.Command.EnableRule.FormStateRule”>

              <FormStateRule State=”Existing” Default=”false” InvertResult=”false” />

            </EnableRule>

          </EnableRules>

        </RuleDefinitions>

        <LocLabels>

          <LocLabel Id=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.Description”>

            <Titles>

              <Title languagecode=”1033″ description=”attachment Description” />

            </Titles>

          </LocLabel>

          <LocLabel Id=”MYDEMO.Form.new_CustomActivity.MainTab.Actions.attachment.LabelText”>

            <Titles>

              <Title languagecode=”1033″ description=”Attach File” />

            </Titles>

          </LocLabel>

        </LocLabels>

      </RibbonDiffXml>

Zip your solution and import it. Now you should be able to see attachment button in your custom entity under action group like below

 Enjoy!!

make sure to rate this post if you like it 🙂

11 Comments

Filed under MS CRM 2011, Step By Step MS CRM 2011

Are you interested in your connection list ??

If you are a sales person and using MS CRM 2011, I am sure you will be interested in your connection lists, so that you can easily associated/disassociate yourself with MS CRM records like account contact.  So how can you see your connection through OOB way, you need to follow below steps:

  • Navigation Setting->Administration->Users->select your record and open it.
  • Navigate to Connection from left navigation items under common section.

You can see all of your connected record.

But what about getting list of your connection directly from left navigation from MS CRM home page that will be great right ? we can easily create link in left navigation are to show view in MS CRM 2011.

So what we need to get that list :

  • Need to create Custom view to display connected entity record with you.
  • Need to get GUID of that view.
  • Modify site map to add new sub area item.

Here is step by step instruction

Create a Custom View to Show connected records and get View ID

  • Create a new Solution and add connection entity in your solution.
  • Navigation to Views under connection entity and select New.
  • Enter “My Connection” under name field and click Ok.
  • Click on “Edit filter criteria” under common tasks.
  • Add filter criteria like below and click Ok.

 

  • Click on “Add columns” to add required colums (make sure to add Connected From field).
  • Press F11 to get view URL.
  • Copy View ID from last, like below

http://Server:port/organization/tools/vieweditor/viewManager.aspx?appSolutionId=%7b739D3A05-017B-E111-88DE-000C296BC8C9%7d&entityId=%7bC7866019-D3D1-40D7-B483-381FCDCCFFB2%7d&amp;id=%7bD7A29797-EF8D-E111-8B09-000C296BC8C9%7d#

  •  Save and Close view.
  • Set this view as Default from more actions.

Now we have created a view and fetched it’s guid, so let’s modify our site map.

You can customize site map manually or customize using wonderful tool Sitemap Editor.

I have used sitemap editor here, first you need to connect to your organization using sitemap editor once you are connected Click on “Load SiteMap” button to load default sitemap from your CRM.

Let’s say we want to create sub area item under My work, follow below steps to create new sub area

  • Navigation to Site Map->Area(Workplace)->Group(MyWork).
  • Right click on Group(myWork) and select Add SubArea.

  • Enter below information

         Id : “MyConnection”

          Entity: Connection

          Icon: specify icon this subarea.

          Title : My Connection

          Description: To Show my connection.

          URL: _root/homepage.aspx?etn=connection&viewid=%7bC4EB2710-A6A1-4CFD-BC94-664416807432%7d&viewtype=1039  //make sure to replace viewid with the id that we created

  • Click on Save button to save configuration for subarea.
  • Click on “Update SiteMap” to update sitemap in MS CRM 2011.
  • Start MS CRM you should get your “My Coonection” subarea under MyWork.

 Enjoy !!!

1 Comment

Filed under MS CRM 2011, Sitemap, Step By Step MS CRM 2011

Step By Step integrating Bing Maps in MS CRM 2011

In this post I am going to show, how easily we can integration bingmap in MS CRM 2011. I am going to create a html webresource which will show account’s city location on bing maps based on city address.

Here are the steps to implement the same

  1. First steps is to get Bingmap developers key.
  2. Create an html page and use below code in this page and save that page. (you can put this page in intpub location and can test this in your browser, in that case you need to hardcode city value).

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;

<html>

   <head>

      <title></title>

      <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>

 

      <script type=”text/javascript” src=”http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0″></script&gt;

 

      <script type=”text/javascript”>

 

          var map = null;

 

          function GetMap() {

              // Initialize the map

             map = new Microsoft.Maps.Map(document.getElementById(“mapDiv”), { credentials: “Your BingMap Key”, mapTypeId: Microsoft.Maps.MapTypeId.road });

 

          }

 

          function ClickGeocode(credentials) {

              map.getCredentials(MakeGeocodeRequest);

          }

 

          function MakeGeocodeRequest(credentials) {

            //Get City value from MS CRM account’s form

              var geocodeRequest = “http://dev.virtualearth.net/REST/v1/Locations/&#8221; + window.parent.Xrm.Page.getAttribute(‘address1_city’).getValue() + “?output=json&jsonp=GeocodeCallback&key=” + credentials; //make sure to replace field name if you are using custom field.

              CallRestService(geocodeRequest);

          }

 

          function GeocodeCallback(result) {

                   if (result &&

                   result.resourceSets &&

                   result.resourceSets.length > 0 &&

                   result.resourceSets[0].resources &&

                   result.resourceSets[0].resources.length > 0) {

                  // Set the map view using the returned bounding box

                  var bbox = result.resourceSets[0].resources[0].bbox;

                  var viewBoundaries = Microsoft.Maps.LocationRect.fromLocations(new Microsoft.Maps.Location(bbox[0], bbox[1]), new Microsoft.Maps.Location(bbox[2], bbox[3]));

                  map.setView({ bounds: viewBoundaries });

 

                  var location = new Microsoft.Maps.Location(result.resourceSets[0].resources[0].point.coordinates[0], result.resourceSets[0].resources[0].point.coordinates[1]);

                  var pushpin = new Microsoft.Maps.Pushpin(location);

                  map.entities.push(pushpin);

              }

          }

 

          function CallRestService(request) {

             var script = document.createElement(“script”);

              script.setAttribute(“type”, “text/javascript”);

              script.setAttribute(“src”, request);

              document.body.appendChild(script);

          }

 

      </script>

   </head>

   <body onload=”GetMap();ClickGeocode();”>

      <div id=’mapDiv’ style=”position:relative; width:400px; height:400px;”></div>

   </body>

</html>

 

3.  Create a HTML webresource and upload your html page here.

4. Open account form and Create a new Tab let’s say Accountlocation.

5. Add a new webresource and browse your webresource from web resource lookup.

 

6. Save and publish your form.

7. Open any account record and check for Account location tab.

Enjoy !!!

Reference : Bing Maps SDK

 

 

20 Comments

Filed under MS CRM 2011, Step By Step MS CRM 2011

Step By Steps Registering plugin through Solution in MS CRM 2011

MS CRM 2011 solution provides facility to register plugin, one of the great feature that I liked, I saw some threads in MS CRM forums where user are how to register plugins using solution. So I am going to write steps that we need to follow to register plugin using Solution.

  1. Create a Solution and set required information.
  2. Included required entities and other resources accordingly.
  3. Select “Plug-in Assemblies”
  4. Click on “Add Existing”, it will open a view select all and click Ok.
  5. Now Select “Sdk Message Processing steps” to include all messages.

6. Click “Add Existing” to add existing steps.

7. Export your solution.

8. Import your solution in Target system.

9. Make sure to select “Activate any processes and enable any SDK message….”

Enjoy !!!

 

1 Comment

Filed under MS CRM 2011, Step By Step MS CRM 2011

Step By Step Extending MS CRM 2011 Ribbon Part-2

In this post I am going to show how to add new group in existing tab. You can check my previous post to add button on exiting group. We need to follow the same steps from 1-5  and then follow below steps.

6. Add a Group node to create a new group.

<Group Id =”MyTest.Account.Form.CustomAction.CustomWeb” Sequence=”60″ Title=”CustomWeb” Template=”Mscrm.Templates.Flexible2″>

<Controls Id =”MyTest.Account.Form.CustomAction.CustomWeb.Controls”>

</Controls>

</Group>

7. Add a CustomAction node for scaling like below
<CustomAction Id=”MyTest.Account.Form.CustomAction.Scaling” Location=”Mscrm.Form.account.MainTab.Scaling._children” Sequence=”1000″>

<CommandUIDefinition>

<MaxSize Id=”MyTest.Account.Form.CustomAction.MaxSize” GroupId=”MyTest.Account.Form.CustomAction.CustomWeb” Sequence=”51″ Size=”LargeLarge” />

</CommandUIDefinition>
</CustomAction>

 

Now your final ribbon definition should look like below

<RibbonDiffXml>
<CustomActions>
<CustomAction Id=”MyTest.Account.Form.CustomAction” Location=”Mscrm.Form.account.MainTab.Groups._children”>

<CommandUIDefinition>

<Group Id =”MyTest.Account.Form.CustomAction.CustomWeb” Sequence=”60″ Title=”CustomWeb” Template=”Mscrm.Templates.Flexible2″>

<Controls Id =”MyTest.Account.Form.CustomAction.CustomWeb.Controls”>

<Button Id=”MyTest.Account.Form.MyCustomButton” ToolTipTitle=”This is Test” ToolTipDescription=”This is test”

Command=”MyTest.Account.Form.CommandDefinition”

Sequence=”10″ LabelText=”Web Testing” Alt=”Test” Image16by16=”/_imgs/ribbon/WebPage_16.png” Image32by32=”/_imgs/ribbon/WebPage_32.png” TemplateAlias=”o1″ />

</Controls>

</Group>

</CommandUIDefinition>
</CustomAction>
<CustomAction Id=”MyTest.Account.Form.CustomAction.Scaling” Location=”Mscrm.Form.account.MainTab.Scaling._children” Sequence=”1000″>

<CommandUIDefinition>

<MaxSize Id=”MyTest.Account.Form.CustomAction.MaxSize” GroupId=”MyTest.Account.Form.CustomAction.CustomWeb” Sequence=”51″ Size=”LargeLarge” />

</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id=”Mscrm.Templates”></RibbonTemplates>
</Templates>
<CommandDefinitions>

<CommandDefinition Id=”MyTest.Account.Form.CommandDefinition”>

<EnableRules>
<EnableRule Id=”Mscrm.Enabled” />

</EnableRules>

<DisplayRules/>

<Actions>

<Url Address =”www.google.com”></Url>

</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules/>
<DisplayRules />
<EnableRules />
</RuleDefinitions>
<LocLabels/>
</RibbonDiffXml>

 

8. Zip your solution, import it and you will get a new group like below.

In my next post I will show how to create a new tab for custom button.

Enjoy !!

Leave a comment

Filed under MS CRM 2011, Step By Step MS CRM 2011