Pages

Thursday 27 June 2013

Copy Email description to case description when email convert to case

How to copy Email description to case description when email convert to case.

For this i have created a small workflow to get this result.

Please see below screenshot.




I have take this workflow on email entity and it will be fired if regarding field change in email. Because when we convert email to case, regarding filed will update automatically in email. so i took like this.

Just Update regarding case of email.

How to create custom entity in CRM 2011

Please follow below steps for create a custom entity in CRM 2011
1.       Navigate to Settings à Solutions. From here, select the appropriate solution you want to add your entity to. You can also create a new solution for your entity if you prefer.
2.       Inside of the selected solution, make sure you have selected components in the Navigation menu, click the New button, and the select Entity. You are presented with the information form for entering general entity settings.
3.       The first thing you need to do when creating an entity is to enter some general settings. Many of these settings can be changed later, but some can only be made when you initially create the entity, and others can be set after the initial entity creation but cannot be changed again after that. Before creating an entity, you should understand these limitations so you can plan an entity that will meet your long term needs.
4.       When you have completed entering your settings, click the save button. You can continue to customize the entity. Then publish all customizations.






Entity definition

The entity definition area includes a number of different important settings as follows:

·         Display Name / Plural Name: These two fields represent the name of the entity as it will appear in Dynamics CRM. In some contexts the plural name will be used, and in others the display name will be used. These values can be changed later if desired.
·         Name: This field is the name that the entity will be referred to if it is referenced within custom code including custom reports, JScript, or other programming code. This field cannot be changed after the entity has been saved for the first time.
·         Description: This field is an optional field with more information on how the entity will be used within Dynamics CRM. It is a best practice to enter text into description fields that documents how the entity will be used. By entering this documentation, you will make it easier to support your instance of Dynamics CRM in the future.
·         Ownership: This field determines who will own each record in the entity. Another way to think about ownership is to ask, “Who will be responsible for maintaining this record in Dynamics CRM?” This field plays an important part in defining security roles and in establishing views and charts of data. After you select a value for this setting and save the entity, you cannot change it. Options for this field are as follows:
·         User or Team: Select this option if every record in this entity will be “owned” by a user or by a team of users. For example, if you create an entity to track projects, then you will most likely want to use this setting because your projects will be assigned to an owner who is responsible for making sure that his or her projects are managed properly.
·         Organization: Select this option if records won’t be owned by any particular individual or team. For example, if you create an entity to track customer inventory, then you will most likely want to use this setting because this inventory will not be owned by a particular user (or team) in your business.

Wednesday 26 June 2013

how to trigger a plug-in from jscript

I can tell you that the question of how to trigger a plug-in from jscript comes up pretty frequently.  Usually someone wants to just trigger the plug-in from a form event, but also sometimes people want to trigger the plug-in from a ribbon button.  Unfortunately, a lot of the replies usually say that it's not supported or not possible. I am happy to say that it is possible and that I have regularly used this workaround to achieve this and it even uses supported methodology.

The code examples I link to today will be for CRM 2011 but the basic methodology is the same for 4.0 also.


Description
Here is how this works:

1. First you need to create a new custom entity to act as a trigger entity, I'll often times even name this new custom entity "new_trigger{plugin name}"


2. Now you must register your plug-in (or several plug-ins) on the create or update messages for this new entity. (I usually prefer the create message for my registrations because a new record will be created which keeps a record or audit-trail of who manually executed your plug-in and when in the created by and created time-stamp attributes on the entity)


3.  You must create a jscript web resource that contains a function that performs a soap update or create call on the entity depending on which message you registered your plug-in on.


4.  Lastly you must add your web resource to your form and call your update or create jscript function on one of the exposed form events (OnLoad, OnSave, etc...).  You can also call your jscript function from ribbon button if you want.

I hope this helps!

Monday 24 June 2013

set value in text field using javascript in crm 2011

How to set value in text field using javascript in crm 2011

function setValueOnload()
{
    Xrm.Page.data.entity.attributes.get("fax").setValue("FAX12345");
    Xrm.Page.data.entity.save();   
}
   (or)
function setValueOnload()
{
    Xrm.Page.getAttribute("fax").setValue("FAX12345");
    Xrm.Page.data.entity.save();
}

Thursday 20 June 2013

Bind data to subgrid dynamically in CRM 2011

The following javascript web resource is used for bind data which is account related activities to subgrid with help of account number.

This is a special functionality in crm 2011.

When we entering a account number, automatically bind that account related activities using onkeyup(it is an event for textbox).


function SetSubGridInfo(accnum) {
    var ProjectGrid = document.getElementById("Activities_Subgrid");
    if (ProjectGrid == null || ProjectGrid.readyState != "complete") {
        setTimeout(SetSubGridInfo, 500);
        return;
    }
    var fetchxml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>";
    fetchxml += "<entity name='activitypointer'>";
    fetchxml += "<attribute name='subject' />";
    fetchxml += "<attribute name='ownerid' />";
    fetchxml += "<attribute name='prioritycode' />";
    fetchxml += "<attribute name='regardingobjectid' />";
    fetchxml += "<attribute name='activitytypecode' />";
    fetchxml += "<attribute name='statecode' />";
    fetchxml += "<attribute name='scheduledstart' />";
    fetchxml += "<attribute name='scheduledend' />";
    fetchxml += "<attribute name='activityid' />";
    fetchxml += "<attribute name='instancetypecode' />";
    fetchxml += "<order attribute='scheduledend' descending='false' />";
    fetchxml += "<filter type='and'>";
    fetchxml += "<condition attribute='isregularactivity' operator='eq' value='1' />";
    fetchxml += "</filter>";
    fetchxml += "<link-entity name='systemuser' from='systemuserid' to='owninguser' visible='false' link-type='outer' alias='activitypointerowningusersystemusersystemuserid'>";
    fetchxml += "<attribute name='internalemailaddress' />";
    fetchxml += "</link-entity>";
    fetchxml += "<link-entity name='account' from='accountid' to='regardingobjectid' alias='aa'>";
    fetchxml += "<filter type='and'>";
    fetchxml += "<condition attribute='accountnumber' operator='eq' value='" + anum + "' />";
    fetchxml += "</filter>";
    fetchxml += "</link-entity>";
    fetchxml += "</entity>";
    fetchxml += "</fetch>";
    ProjectGrid.control.setParameter("fetchxml", fetchxml);
    ProjectGrid.control.refresh();
}
function registerOnKeyUp() {
    var attr = "new_accountnumber";
    var el = document.getElementById(attr);
    el.onkeyup = function () {
        var edValue = document.getElementById(attr);
        var s = edValue.value;
        SetSubGridInfo(s);
    }
}

Tuesday 18 June 2013

How to search resolved cases using case number in quick search box

The following post describes the how to search resolved cases in search box in CRM2011.

1.    Open Default Solution then navigate to Case entity and Click on the Views.


2.    There we can find a Quick Find Active Cases view. Please double click on that.
3.    Here we can see Edit Filter Criteria Option at Right side navigation as shown the screenshot. Please click on that.


4.    Here we can see a query like status equal Active, So Just change the query like status equal Active, Resolved. For this Just do it now.
5.    Just add an option Resolved from Available values to Selected Values. Click Ok.

6.    Finally Save and Publish the Case Entity.


Now start search your Resolved cases also.

Saturday 15 June 2013

How to add Custom button in CRM entity ribbon.

The following post is describe the adding custom button in Entity Ribbon using visual ribbon editor.
 
We can download Visual Ribbon Editor from here.                                                                                
                                            
1.Open Ribbon editor application.                                                                                                          
 
 
 
2.Click on sever connection button( first button ) to connect to CRM.                                              

 
3.When server connection get completed, we can open an entity ribbon when click on the "Open"  button. Then we can get entities drop down list. There we can select an entity for add custom button.

 
4. We have three types of ribbons                                                                                                     
a. Form                                                                                 
                  b. Home Page                                                                                         
c. Subgrid                                                                             
 
Form type is selected default. There we can see a button named "New Button" .Just click on that
    to add custom  button                                                                                                                           

 
5. Add Button Name then click ok button.                                                                                


 
 
                                            
6. Now we can see a Custom button in Entity ribbon. Just select the button once ,we can get button information.                                                                                                                                   
 
We have to add image web resources url's for button icon.                                                        



7. We need to add javascript web resource to fire an action when clicked on the button.




8. These are display rules. The rules shows the button in which form type like when creating or When Existing record or both like that.



This way we can add custom button in Entity ribbon in CRM 2011.

I hope it is very useful to CRM guys..

Thank you

Friday 14 June 2013

Auto Populate Multi-line text field from check box selections

The following javascript web resource is for fire event when check box clicked or checked in CRM 2011.
We can get immediate response when CRM check box is Checked or Unchecked.

Here is the example for Auto Populate Multi-line text field from check box selections.

Here three check boxes are available. When click on first check box, The text "First option is true" will populate in custom multiline textbox field. As well as click on the second check box, The text "second option is true" will populate in custom multiline textbox field without overwrite data.

This information has to populate the text box instantly so the user can make changes BEFORE saving the record .

function CheckOptionOnload()
{
  RegisterCheckBoxOnclick();
}
function RegisterCheckBoxOnclick()
{
         registerCheckboxClick("new_firstoption");
         registerCheckboxClick("new_secondoption");
         registerCheckboxClick("new_thirdoption");
}
function CheckOption()
{
    var myAttribute1 = "new_firstoption";
    var myControl1 = Xrm.Page.ui.controls.get(myAttribute1);
    var  myCheckboxValue1 = myControl1.getAttribute().getValue();
    var myAttribute2 = "new_secondoption";
    var myControl2 = Xrm.Page.ui.controls.get(myAttribute2);
    var  myCheckboxValue2 = myControl2.getAttribute().getValue();
    var myAttribute3 = "new_thirdoption";
    var myControl3 = Xrm.Page.ui.controls.get(myAttribute3);
    var  myCheckboxValue3 = myControl3.getAttribute().getValue();
   if(myCheckboxValue1 ==false && myCheckboxValue2 ==false && myCheckboxValue3 ==false)
    {
             Xrm.Page.getAttribute("new_description").setValue(null);
    }
   else
    {
       var data="";
       if (myCheckboxValue1 == true)
       {
         data=data+ "First Option is true \n";
         Xrm.Page.getAttribute("new_description").setValue(data);
       }
       if (myCheckboxValue2 == true)
       {
         data=data+ "Second Option is true \n";
        Xrm.Page.getAttribute("new_description").setValue(data);
       }
      if (myCheckboxValue3 == true)
      {
         data=data+ "Third Option is true \n";
         Xrm.Page.getAttribute("new_description").setValue(data);
      }
    }
  }
function registerCheckboxClick(attr) {
  //var attr="new_firstoption";
   var ctrl = Xrm.Page.ui.controls.get(attr);
    var a = ctrl.getAttribute();
    var el = document.getElementById(attr);

    // Build Toggle Function
    var f = "var ef=function() { " +
              "var a = Xrm.Page.data.entity.attributes.get(attr); " +
              "a.setValue(!a.getValue()); a.fireOnChange();" +
              " };";

    eval(f);
   // Attach to click event
    el.attachEvent('onclick', ef, false);
}


Here events and functions are
Onload : CheckOptionOnload
Onchange : CheckOption



 

Thursday 13 June 2013

Exam MB2-876: Extending Microsoft Dynamics CRM 2011

CHAPTER 1: EXTENSIBILITY OVERVIEW

The objectives are:
Describe how Microsoft Dynamics CRM is designed to be extended.
Recognize the core Microsoft Dynamics CRM developer extensibility features.
Explain how the Microsoft Dynamics CRM Security Model affects custom development and design.
Explain how "business logic" is incorporated into Microsoft Dynamics CRM.
Review the overview for how entities are structured and defined within the xRM Framework.
Examine how data access is handled with the application.
Recognize the skills developers will use to extend Microsoft Dynamics CRM.
Identify the resources that are available to support developers.


CHAPTER 2: COMMON PLATFORM OPERATIONS

The objectives are:
Discuss the use and benefits of the Windows Communication Foundation in Microsoft Dynamics CRM
    2011.
Use the Discovery Service web service to access Organization-level information.
Explain the differences between early and late-bound classes.
Use the code generation tool to create a file which contains multiple classes to use in early-bound code.
Explain the advantages and process of using early-bound code.
Develop custom code that used late-bound classes.
Reference and use the Organization Service.
Explain security dependencies.
Identify how Entity information is used within the Organization web service.
Identify the different Microsoft Dynamics CRM data types.
Use the Create method of the Organization Service class to create a new record in Microsoft Dynamics
    CRM.
Use the Retrieve method of the Organization class to retrieve a single record.
Use the Update method of the Organization Service class.
Use the Delete method of the Organization Service class.
Use the RetrieveMultiple method of the Organization Service class.
Identify how to manage exceptions thrown by the Microsoft Dynamics CRM platform.

CHAPTER 3: QUERYING DATA AND EXECUTING OPERATIONS

The objectives are:
List querying options available to Microsoft Dynamics® CRM developers.

Use the QueryExpression class to retrieve Microsoft Dynamics CRM records based on complex
    criteria.
Use the QueryByAttribute class for simple queries.
Identify the benefits and appropriate uses of LINQ when querying and interacting with Microsoft
    Dynamics CRM data.
Demonstrate and explain the uses of FetchXML when querying Microsoft Dynamics CRM data.
Examine how filtered views can be used to access Microsoft Dynamics CRM data by using SQL.
Use and specify OData elements when querying Microsoft Dynamics CRM data.
Use the Execute method of the Organization Service for more specific platform operations.
Identify common Request and Response classes.
Access and update schema information through the Organization Service web service.

CHAPTER 4: IMPLEMENTING BUSINESS PROCESSES

The objectives are:
Identify core workflow features in Microsoft Dynamics CRM.
Review the basic concepts, terminology, and benefits of using dialogs.
Examine the steps involved in developing and deploying custom workflow activities.
Create custom workflow activities.
Debug custom workflow activities.
Modify an existing Microsoft Dynamics CRM 2011 workflow in Visual Studio 2010.

CHAPTER 5: PLUG-INS

The objectives are:
Identify how plug-ins can be used to extend Microsoft Dynamics CRM.
Review the Microsoft Dynamics CRM event framework.
Examine Plug-in Isolation, Trusts, and Statistics.
Develop plug-ins.
Use impersonation in plug-ins.
Use Entity Classes in plug-ins.
Register and deploy plug-ins.
Debug plug-ins.
Integrate Windows Azure with Microsoft Dynamics CRM.

CHAPTER 6: APPLICATION EVENT PROGRAMMING

The objectives are:
Use JScript Libraries to customize Microsoft Dynamics ®CRM.
Explore form and field events.
Examine the Xrm.Page object.
Examine the Xrm.Page.context (client-side context) object.
Examine the Xrm.Page.data.entity object.
Examine the Xrm.Page.ui object.
Explore form types.
Examine the form event handler execution context.
Identify how to set event dependencies.
Evaluate how parameters can be used within Microsoft Dynamics CRM 2011 forms.
Apply best practices when writing client-side code.
Identify how to debug client-side code.

CHAPTER 7: CLIENT EXTENSIONS

The objectives are:
Integrate web pages into the user interface by using the Site Map.
Describe the steps to modify the Ribbon.
Demonstrate the use of Custom Actions, Rules, and Localizing Ribbon controls.
Describe how URL Addressable forms can be used.

CHAPTER 8: WEB RESOURCES

The objectives are:
Overview the use of web resources in Microsoft Dynamics CRM 2011.
Evaluate how parameters can be used within Microsoft Dynamics CRM 2011.
Demonstrate how web resources are implemented and utilized within Microsoft Dynamics CRM 2011.
Practice referencing web resources within other web resources.
Implement the use of a Silverlight web resource.
Define REST.
Examine and understand the use of ATOM and JSON.
Understand and demonstrate how JQuery can be utilized in Microsoft Dynamics CRM 2011.

Entity Relationship Behavior in CRM 2011

Before describing how to configure entity relationship behaviors it is useful to consider how it applies to your business. Three key concepts are:


Preserve Data Integrity
Automate Business processes
Cascading behavior
 
Preserve Data Integrity
Each entity can have rules that define a valid record. For example, a Microsoft Dynamics CRM opportunity record must include a reference to a potential customer. Users cannot create a new opportunity record without either adding an existing customer or creating a new customer record.
But what should happen if the account or contact that represents the customer is deleted? In a case like this, possible alternatives are to either:
 
 

  • Restrict any attempt to delete a customer record with an associated opportunity.


  • Cascade the delete action when a corresponding customer record is deleted so that any related opportunity records are automatically deleted.

In Microsoft Dynamics CRM for the one-to-many relationships that relate opportunities with customers, such as Opportunity.opportunity_customer_accounts and Contact.opportunity_customer_contacts, the behavior is to cascade the delete action.
When you model your data to use in Microsoft Dynamics CRM you will have similar decisions for how you want to preserve data integrity.
Automate Business Processes
Your business processes may require you to perform actions on records that have related records. For example, you may need to assign an account to a new salesperson. If that account record has any opportunity records, some options include:

  •  Do nothing.
  • The opportunities should continue to be owned by the individuals who work on them.


  • Assign all the opportunities to the new salesperso
  • As the new owner of this account record, the salesperson is now responsible for all opportunities related to that account.


  • Only assign the active opportunities to the new salesperso
  • Preserve the owner for any inactive opportunity records for reporting purposes.


  • Only assign the opportunities owned by the previous account owner to the new salesperson
  •  This allows the new salesperson to replace the previous owner.

These options are common ones you can configure using entity relationship behavior in Microsoft Dynamics CRM. If you require different behaviors consider purchasing a solution containing the behavior you need or developing a plugin to provide additional options.
Cascading Behavior
These configuration options are called cascading behaviors because they cascade down the hierarchy of related entities. For example, if deleting an account causes related opportunities to be deleted, what about the activities associated with the opportunities? In Microsoft Dynamics CRM the behavior defined in each of the entity relationships for activity type entities is that they are deleted as well.
However, not all entities are treated this way. For example, orders and invoices contain important business data that shouldn’t be inadvertently deleted. They have entity relationship behavior configured to restrict deleting customer or opportunity records that they are associated with. Before you can delete the customer or opportunity that has a related order or invoice record, you must delete the order or invoice first.
As you model your business data by creating custom entities or when using existing Microsoft Dynamics CRM system entities, consider the behavior you require and the implications for the entire hierarchy of related entities.
Parental Entity Relationships
Each pair of entities that are eligible to have a 1:N relationship can have multiple 1:N relationships between them. Yet only one of those relationships can be considered a parental entity relationship.
A parental entity relationship is any 1:N entity relationship where one of the cascading options (defined in CascadeType) in the Parental column of the following table is true.
 
Action

Parental

Not Parental

Delete
Cascade

RemoveLink
Restrict

Share
Cascade
UserOwned
Active

NoCascade

Unshare
Cascade
UserOwned
Active

NoCascade

Assign
Cascade
UserOwned
Active

NoCascade

Reparent
Cascade
UserOwned
Active

NoCascade

Each referencing entity in a 1:N entity relationship has one referencing attribute where the relationship can be considered parental.
For example, if you create a new custom entity and add a 1:N entity relationship with the account entity where your custom entity is the referencing entity, you can configure the actions for that entity relationship to use the options in the Parental column. If you later add another 1:N entity relationship with your custom entity as the referencing entity you can only configure the actions to use the options in the Not Parental column.
Usually this means that for each entity pair there is only one parental relationship. There are some cases where the referencing attribute on the referencing may include a reference to more than one type of entity.
For example, the Opportunity entity has a referencing attribute called customerid where a reference to either a contact or account record may be stored. There are two separate parental 1:N entity relationships in this case.
Any activity entity, for example, a task, fax, phone call, and so on, has a similar set of parental entity relationships for entities that can be associated using the regardingobjectid referencing attribute.
Configuring Entity Relationship Behavior
When you use
CreateOneToManyRequest or UpdateRelationshipRequest you include an instance of a OneToManyRelationshipMetadata class in the body of the request. In the CascadeConfiguration property of that class you use the CascadeConfiguration class.
The CascadeConfiguration class contains the properties representing actions that may be performed on the referenced entity in the one-to-many entity relationship. Each property can be assigned one of the values of the CascadeType enumeration.
 
Value

Application label

Description

Active

Cascade Active

Perform the action on all active referencing entity records associated with the referenced entity record.

Cascade

Cascade All

Perform the action on all referencing entity records associated with the referenced entity record.

NoCascade

Cascade None

Do nothing.

RemoveLink

Remove Link

Remove the value of the referencing attribute for all referencing entity records associated with the referenced entity record.

Restrict

Restrict

Prevent the Referenced entity record from being deleted when referencing entities exist.

UserOwned

Cascade User Owned

Perform the action on all referencing entity records owned by the same user as the referenced entity record.

The
CascadeConfiguration class contains the following properties representing actions that may be performed on the referenced entity in the one-to-many entity relationship.
 
Action

Description

Valid options



The referenced entity record owner is changed.

Active
Cascade
NoCascade
UserOwned



The referenced entity record is deleted.
Note

The options for this action are limited.

 
Cascade
RemoveLink
Restrict



The record is merged with another record.
Note

For referenced entities that can be merged, Cascade is the only valid option. In other cases use NoCascade.

 
Cascade
NoCascade



See
Active
Cascade
NoCascade
UserOwned



When the referenced entity record is shared with another user.

Active
Cascade
NoCascade
UserOwned



When sharing is removed for the referenced entity record.

Active
Cascade
NoCascade
UserOwned

The Reparent Action
The reparent action is very similar to the share action except that it deals with the inherited read access rights instead of explicit read access rights.
Note

For more information about inherited access rights, see
The reparent action is when you change the value of the referencing attribute in a parental relationship. When a reparent action occurs, the desired scope of the inherited read access rights for related entities might change. The cascade actions related to the reparent action refer to changes to read access rights for the entity record and any entity records related to it. For more information about how an entity relationship is configured to be parental, see
For example, there is a parental relationship between Opportunity and Account based on the CustomerId referencing attribute. If you are the owner of an account and there is an opportunity associated with that account, you inherit read access rights to that opportunity and any records associated with it. If the CustomerId referencing attribute value for the opportunity is changed to refer to a different account, the owner of that account inherits read access rights to the opportunity if the Reparent action is Cascade. You can disable this automatic inheritance of read access rights if you set the reparent action to NoCascade. You can use the Active or UserOwned options to specify filters on which records are affected by the change in access rights. For any records related to the opportunity using a parental relationship, the reparent action cascades down those entity relationships and read access rights are inherited based on the filters set for the Reparent action.