RSS

Tag Archives: Abhisek Sriramka

Cascade Relationship Behavior in Microsoft Dynamics CRM

Introduction

This Blog is all about out-of-the-box Cascade Relationship Behavior and how to use it in more efficient way as per the business.

Default Behavior:

When an Account record “Company1, Inc.” is reassigned to another owner “User2” from “User1” then as per the default “Parental Relationship Behavior” all the completed and open child records i.e. Contacts, Opportunities, cases, Tasks, Emails, Phones calls, etc. are also reassigned to the another owner “User2“, but the important point here is to keep the completed Entities and Activities records impaired in any way to avoid confusions in future.

Image

Is there a workaround for this?

Yes, to change this setting, here are few simple steps:

  1. Go to “CRM >> Settings >> Customization >> Customize the System >> Account >> 1: N Relationships”.

    Image

  2. Open the desire relationship record and change the “Type of Behavior” from “Parental” to “Configurable Cascading“.

    Image

  3. Now often we think of the meaning of these behaviors i.e. Cascade Active/Cascade User-Owned/Cascade None.
    • Cascade Active: means owner will change only if record is Active.
    • Cascade User-Owned: means owner will change only if the related record owner is same as Parent record.
    • Cascade None: means owner will not change.
  4. So, as I explained above, to avoid confusion in future about the completed records we just need to change the “Assign” field value from “Cascade Relationship Behavior” to “Cascade Active“.

    Image

By Abhisek Sriramka
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

Advertisements
 

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,

How to Bulk Delete Workflow Jobs in Microsoft Dynamics CRM

Introduction

Whenever a Workflow is triggered, a System Job record is created in Microsoft Dynamics CRM and this will be a burden on CRM database. So, eventually Microsoft Dynamics CRM Administrator needs to clean-up the existing Workflow Jobs. Here, we will explore a very quick and easy way to bulk delete all the existing completed System Jobs created by Workflows in Microsoft Dynamics CRM.

 Steps

Image

Login in to Microsoft CRM >> Settings >> Data Management >> Bulk Record Deletion >> click New to start the Bulk Deletion Wizard.

Click Next on the Wizard >> Look for: “System Jobs” >> set the following criteria:

  • Status Equals Completed
  • System Job Type Equals Workflow

Image

Click Next to set the options such as Start Date and Time, set Number of Days to run this recursively & to send a notification when job is finished.

Image

Click Next and Submit it.

By Abhisek Sriramka
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

 
Leave a comment

Posted by on December 24, 2013 in CRM WorkFlow

 

Tags: , , , , , , , , , , , , , , , , , , ,

CRM2013 – Form Level Notifications

Introduction

In this blog, I will explain how to display Form level Notifications in CRM 2013.

Background

The requirement was, on entering an Account form the Account Number must be greater than 4 digits and Main Phone is a mandatory field or else we will show a notification “Account number should be more than 4 digits” and “Main phone field is mandatory” on the Form level.

Code

We will use the following two methods for our task.

  • setFormNotification(message, level, uniqueId) : To set the notification on Form level.
    1. message : Text of the notification.
    2. level : Message icon – can be “ERROR”, “WARNING” or “INFO”.
    3. uniqueid : Id to be used to clear notification.
  • clearFormNotification() : To remove the Notification from the Form.

Code can be used onChange or onSave event.

//Function To Show Error Notification On Form Level
function FormNotificationError()
{
    //Check If Digit Count of Account Number Is Less Than 4 or not
    if (CountDigit(Xrm.Page.getAttribute("accountnumber").getValue()) <= 4)
    {
        //Set The Form Notification With Error Icon
        Xrm.Page.ui.setFormNotification("Account number should be more than 4 digits", "ERROR", "accountnumber");
    }
    else
    {
        //Clear Notification
        Xrm.Page.ui.clearFormNotification("accountnumber");
    }
}

//Function To Show Warning Notification On Form Level
function FormNotificationWarning()
{
    //Check If The Main Phone Is Not Blank
    if (Xrm.Page.getAttribute("telephone1").getValue() == null)
    {
        //Set The Form Notification With Warning Icon
        Xrm.Page.ui.setFormNotification("Main phone field is mandatory", "WARNING", "telephone1");
    }
    else
    {
        //Clear Notification
        Xrm.Page.ui.clearFormNotification("telephone1");
    }
}

//Function To Get Count Of Digits
function CountDigit(number)
{
    return number.toString().length;
}

Output

Image
The screen shot displays the notification on the Form level for Account Number and Main Phone.

By Abhisek Sriramka
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

 
 

Tags: , , , , , , , , , , , , , , , , ,

CRM 2013 – Field Level Notification

Introduction

In CRM 2011, there was no Out of Box Functionality to show client side notifications on the Entity. We have used JScripts functions to show alert messages using Web Resources. In CRM 2013, Microsoft has introduced some new methods to show notifications on client side.

Background

The requirement was, while entering data in an Account form, the Account Number must be greater than 4 digits, else we had to show a notification “The account number should be more than 4 digits” on the field level.

Code

We will use following two methods for our task.

  • setNotification(message) : To set the Notification near the field
  • clearNotification() : To remove the Notification from the field

Code can be used onChange or onSave event.

//Function To Set Notification On Field Level
function SetFieldNotification()
{
    //Get The Control
    var field = Xrm.Page.getControl("accountnumber");

    //Get The Count Of Digits In Acccount Number
    var numberOfDigit = CountDigit(field.getAttribute().getValue());

    //Check if digit count of Account Number is less than 4 or not
    if (numberOfDigit <= 4)
    {
        //Set The Notification
        field.setNotification("The account number should be more than 4 digits");
    }
    else
    {
        //Clear The Notification
        field.clearNotification();
    }
}

//Function To Get Count Of Digits
function CountDigit(number)
{
    return number.toString().length;
}

Output

Image The Screen shot displays the notification near Account Number field.

By Abhisek Sriramka
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

 
Leave a comment

Posted by on November 29, 2013 in WebResources

 

Tags: , , , , , , , , , , , , , , , , , ,

Get the Created Records When Lead is Qualified Using Plug-in

Introduction

This blog explains how to register a plug-in in “QualifyLead” message and get the created record when lead is qualified.

Background

Let in some requirement, when a lead is qualified then if you need some custom logic to work then in this scenario you can register you plug-in on the “QualifyLead” message and “Post Operation” Stage.

Code

We can easily get the newly created account, contact and opportunity records and can do any required changes in them.

Codes that will be used inside the plug-in :

// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

// Obtain the organization service reference.
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

// Getting the service from the Organisation Service.
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

// Get the qualified lead.
EntityReference leadid = (EntityReference)context.InputParameters["LeadId"];
Entity lead = service.Retrieve("lead", leadid.Id, new ColumnSet(true));

foreach (EntityReference created in (IEnumerable<object>)context.OutputParameters["CreatedEntities"])
{
    //Check if Account record is created when lead qualified.
    if (created.LogicalName == "account")
    {
        Entity account = service.Retrieve("account", created.Id, new ColumnSet(true));
    }
    
    //Check if Contact record is created when lead qualified.
    if (created.LogicalName == "contact")
    {
        Entity contact = service.Retrieve("contact", created.Id, new ColumnSet(true));
    }

    //Check if Opportunity record is created when lead qualified.
    if (created.LogicalName == "opportunity")
    {
        Entity opportunity = service.Retrieve("opportunity", created.Id, new ColumnSet(true));
    }
}

To update any of the created account, contact and opportunity we can use the retrieved data as per below :

Entity entAccount = new Entity("account");
entAccount["accountid"] = account.Attributes["accountid"];
entAccount["name"] = "Test Account Name";
service.Update(entAccount);

By Abhisek Sriramka
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

 
3 Comments

Posted by on April 29, 2013 in CRM Plug-in

 

Tags: , , , , , , , , , , , , , , ,

 
%d bloggers like this: