CRMBuzz.net

Abe Saldana on Microsoft Dynamics CRM Development
posts - 18, comments - 5, trackbacks - 0

Thursday, June 12, 2008

How to's - Detach an E-mail from a Queue

The E-mail to Case process one of the final steps is to make the e-mail not to display on the Queue, that is called detaching from the queue, this blog post is a follow up on one of the initial blog post on this new CrmBuzz URL, the original post was How to Detach an Email from a Queue? Summary..., so finally after some replies and follow up e-mails and questions I got the time to put in the details for one of most requested line:

returnStatus = emailDetach.EmailDetachFromQueue(EmailID, SourceQueueId);

 

The code snipped: 

   1: public bool EmailDetachFromQueue(Guid EmailID, Guid SourceQueueID)
   2: {
   3:     bool returnvalue = false;
   4:     try
   5:     {
   6:  
   7:         DetachFromQueueEmailRequest detachEmail = new DetachFromQueueEmailRequest();
   8:         detachEmail.EmailId = EmailID;
   9:         detachEmail.QueueId = SourceQueueID;
  10:  
  11:         DetachFromQueueEmailResponse detachedEmailResponse = (DetachFromQueueEmailResponse)service.Execute(detachEmail);
  12:  
  13:         returnvalue = true;
  14:  
  15:     }
  16:     catch (System.Exception e)
  17:     {
  18:         returnvalue = false;
  19:  
  20:     }
  21:  
  22:     return returnvalue;
  23: }

 

The E-mail detach process will not give you too much information on the validity on the completion and you probably will need to validate making another call, so these are some of the steps for the e-mail to case (incident)

  1. Validate E-mail content is not Spam or Duplicate
  2. Create new Contact with E-mail address information
    1. Create new Account with E-mail address information
    2. Relate new Account with new Contact
  3. Validate that E-mail is not relation to any Case (Incident)
  4. Create new Case (Incident) with E-mail information
  5. Detach E-mail from the Queue (Private or Public Queue)
  6. Assign the new Case (Incident) to the User Private Queue (Incident Owner)

 

So these are the most common steps for converting an E-mail to a Case, I will be working on a similar process for Spam e-mails on MS Dynamics CRM 4.0 but in this version I will be using the Workflow's capabilities, stay tuned for more details on the new workflow E-mail to Case process.

Check the Articles soon you would find information related to SDK connectivity with CRM 4.0 On Premises and Online versions

 

Abe Saldaña

CrmBuzz.net

This all is undocumented and unsupported. Therefore you should only try these kinds of modifications if you feel comfortable working with this.
Everything here, though, is my personal opinion and is not read nor approved before being posted. No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.

posted @ Thursday, June 12, 2008 4:50 PM | Feedback (0) | Filed Under [ Callouts Code Level 300 MS Dynamics CRM 3.0 Performance SDK code Unsupported ]

Wednesday, June 11, 2008

How to's - Getting your Lead Status and State

Working on the previous blog post I have to get some information on the Lead's status and state, just to validate that the lead was not already qualified or disqualified and then make the conversion to an Account and to a Contact, so I started to create a SDK generic library type of assembly with the most common things I will be using on a daily basis.

Working on a lead the first thing I will be doing is check if the lead remains Open [Status = 1 and State = 0 ] or that is not Qualified [ Status = 3  and State = 1 ] and if the lead is not Disqualified [Status = 4 (Most Common - Lost) and State = 2], here is some code to get the independent values:

Getting the Lead Status Information:
 
   1: public int getStatus(Guid leadID)
   2: {
   3:     int returnValue;
   4:  
   5:     try
   6:     {
   7:         lead leadInformation = (lead)service.Retrieve(EntityName.lead.ToString(), leadID, new AllColumns());
   8:  
   9:         returnValue = leadInformation.statuscode.Value;
  10:  
  11:     }
  12:     catch( Exception)
  13:     {
  14:         returnValue = -1;
  15:     }
  16:  
  17:     return returnValue;
  18:  
  19: }
 
Getting the Lead State Information:
 
   1: public int getState(Guid leadID)
   2: {
   3:     int returnValue;
   4:     
   5:     try
   6:     {
   7:         lead leadInformation = (lead)service.Retrieve(EntityName.lead.ToString(), leadID, new AllColumns());
   8:  
   9:         returnValue = ((int)leadInformation.statecode.Value);
  10:  
  11:     }
  12:     catch (Exception)
  13:     {
  14:         returnValue = -1;
  15:     }
  16:     return returnValue;
  17: }

Note: the Lead State value is returned un-boxing the object value from the enum CRMSDK.LeadState

 

Well that is good to pull the value from the lead, but as part of the conversion process I needed to change the status from Open to Qualified, so I needed to have the Update Method and handle the validation for the update, the lead status is handle not from the Service.Update but the state is managed by the SetStateLeadRequest object, here is the code for updating the Status

   1: public bool UpdateStatus(Guid leadID, int Stateparam, int Statusparam)
   2: {
   3:     bool returnValue = false;
   4:  
   5:     try
   6:     {
   7:         SetStateLeadRequest leadUpdateRequest = new SetStateLeadRequest(); 
   8:  
   9:         leadUpdateRequest.EntityId = leadID ;
  10:         
  11:         leadUpdateRequest.LeadStatus = Statusparam;
  12:  
  13:         LeadState valueState = (LeadState)Enum.ToObject(typeof(LeadState),Stateparam);
  14:         leadUpdateRequest.LeadState = valueState;
  15:         
  16:         SetStateLeadResponse stateSet = (SetStateLeadResponse)service.Execute(leadUpdateRequest);
  17:  
  18:         int resultStateCode = getState(leadID);
  19:  
  20:         if (resultStateCode == Stateparam)
  21:         {
  22:             returnValue = true;
  23:         }
  24:  
  25:     }
  26:     catch(Exception)
  27:     {
  28:         returnValue = false;
  29:     }
  30:  
  31:     return returnValue;
  32:  
  33: }

 

After all this the conversion code was so simple to put together and easy to read, I hope the following code snipped's will work for you, keep in mind that I just put the core of the code, CRM connection objects and class definition are not included you need to create those and then test the code 

 

Abe Saldaña

http://crmbuzz.net 
Everything here, though, is my personal opinion and is not read nor approved before being posted.

No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.

posted @ Wednesday, June 11, 2008 6:07 PM | Feedback (0) | Filed Under [ Callouts Code Level 300 MS Dynamics CRM 3.0 SDK code ]

Wednesday, May 28, 2008

Converting a Lead to Contact and Account

Working on a special project, I have to recreate the Lead conversion and make some other customizations on the Accounts and Contact relationship, the first code I was looking was the conversion using the Relationship mapping, I found some code regarding the related request/response, but looking under the SDK documentation finally find some code hints that I can use for the conversion.

The following is the code for converting a source entity to a target entity, taking in consideration the relationship mapping using the TargetRelatedRequest and response classes (CRM 3.0 SDK)

 

/// <summary>
///  Convert to Contact, Convert/Create first the Contact then the Account
/// </summary>
public Guid ConvertLead2Contact(Guid leadIdvalue)
{
InitializeFromRequest requestObject = new InitializeFromRequest();
 
requestObject.EntityMoniker = new Moniker();
requestObject.EntityMoniker.Id = leadIdvalue;
requestObject.EntityMoniker.Name = EntityName.lead.ToString();
 
requestObject.TargetEntityName = EntityName.contact.ToString();
requestObject.TargetFieldType = TargetFieldType.All;
 
InitializeFromResponse responseObject = (InitializeFromResponse)service.Execute(requestObject);
 
contact returnContact = (contact) responseObject.Entity;
 
    // You need to create the new created Contact Entity
    Guid returnContactId = service.Create(returnContact.Entity);
 
return returnContactId;
}

 

/// <summary>
/// Convert Lead to Account, Convert the Account after the Contact.
/// </summary>
public Guid ConvertLead2Account(Guid leadIdvalue, Guid primaryContactId)
{
InitializeFromRequest requestObject = new InitializeFromRequest();
 
      requestObject.EntityMoniker = new Moniker();
      requestObject.EntityMoniker.Id = leadIdvalue;
      requestObject.EntityMoniker.Name = EntityName.lead.ToString();
 
      requestObject.TargetEntityName = EntityName.account.ToString();
      requestObject.TargetFieldType = TargetFieldType.All;
 
InitializeFromResponse responseObject = 
    (InitializeFromResponse)service.Execute(requestObject);
 
      account returnAccount = (account) responseObject.Entity;
 
if(primaryContactId != null)
{
 
    If(primaryContactId != Guid.Empty)
    {
// relationship with the Contact
returnAccount.primarycontactid = 
CrmTypes.CreateLookup(EntityName.contact.ToString(),primaryContactId);
 
    }
 
}
 
    // You need to create the new converted Account
    Guid returnAccountId = service.Create(returnAccount.Entity);
 
      return returnAccountId;
 
}

Notes:

I assume you already created or added the CRM Web Service reference and created the CrmService object (service) in your project. Also I'm using the CrmTypes class to help create CRM type objects

The Lead status is not change using the TargetRelatedRequest I will post another article where is going to guide you and have code snippets to check the value, Qualify, Disqualify and Reactivate the Lead.

Hope this article will help.

Abraham Saldaña

http://crmbuzz.net

posted @ Wednesday, May 28, 2008 4:36 AM | Feedback (0) | Filed Under [ Callouts Code Level 300 MS Dynamics CRM 3.0 SDK code Unsupported ]

Thursday, February 21, 2008

Microsoft Dynamics CRM 4.0 Training Documentation

Partners enrolled in a Partner Service Plan for Microsoft Dynamics™ now have unlimited organizational access to online training for Microsoft Dynamics and related business products.

If you are not enrolled in a Partner Service Plan, learn more at Partner Source > Services & Service Plans > Partner Service Plans to choose the plan that is right for your organization!

Training Document Links:
Installation and Deployment in Microsoft Dynamics CRM 4.0 Course number 8911*

Customization and Configuration in Microsoft Dynamics CRM 4.0 Course Number 8912*

Applications in Microsoft Dynamics CRM 4.0 Course Number 8913*


Microsoft Dynamics CRM Team Blog
http://blogs.msdn.com/crm/archive/2008/01/28/crm-4-0-training-resources.aspx

posted @ Thursday, February 21, 2008 12:46 PM | Feedback (1) |

Free Software for Students - Microsoft DreamSpark

How would you like a free copy of Microsoft Visual Studio 2008? How about the entire Microsoft Expression Studio? Not enough...... how about Microsoft Windows Server 2003 and more?

Today, Microsoft announced an unprecedented software program that we believe will help change the lives of millions of students around the world. The program, Microsoft DreamSpark, is focused on providing millions of college and high school students with no-cost access to the latest Microsoft developer (i.e., versions of Visual Studio, XNA Game Studio), designer tools (Expression Studio) and Microsoft platform resources (i.e., versions of Windows Server and SQL Server).

Currently, the program is accessible by college students in 11 countries including: Belgium, Canada, China, Finland, France, Germany, Spain, Sweden, Switzerland, the United Kingdom and the United States.  In the coming months, the Microsoft DreamSpark team will expand the program’s reach to include high school students and to increase the number of participating countries.

Please visit Channel 8, https://downloads.channel8.msdn.com/ to learn more about Microsoft DreamSpark.

posted @ Thursday, February 21, 2008 12:36 PM | Feedback (0) |

Thursday, January 17, 2008

CRM 4.0 Training Data

Sample data can be used for marketing and sales presentations or for training people to use Microsoft Dynamics CRM 4.0.

Ronnald Lemmen posted the following blow:

http://ronaldlemmen.blogspot.com/2008/01/dynamics-crm-40-test-data.html

 

Overview

"You can use sample data in the Microsoft Dynamics CRM 4.0 Sample Database in marketing and sales presentations or for training people to use Microsoft Dynamics CRM 4.0. "


"The sample database includes a set of comma-separated value (CSV) files that contains the sample data and an XML map file that maps the data to Microsoft Dynamics CRM 4.0. You use the Data Migration Manager to install the sample data."

Microsoft Dynamics CRM 4.0 Sample data

Microsoft Dynamics 4.0 Sample Data Installation Instructions

 

Have fun installing and testing the data.

Abe Saldana

www.crmbuzz.net

posted @ Thursday, January 17, 2008 10:06 AM | Feedback (0) |

Monday, January 14, 2008

What .Net Framework can I use for Plug-ins and custom Workflow?

Microsoft Dynamics CRM 4.0 (Titan) uses the .Net Framework 3.0, this is the officially supported version.  To be on the safe side you can continue using the .Net Framework 2.0 and 3.0, if you use the .Net Framework 3.5 make sure that your servers are current with the version and make a lot of testing before move to production.

The CRM Team blog mentioned the following when creating plug-ins using .Net framework 3.5:

"If you develop a plug-in using 3.5 and refer to the LINQ libraries, and then deploy it to a server without the framework 3.5, your plug-in will fail because those libraries aren't installed"

"Stay on the safe side and use the .Net Framework 3.0"

 

Well I will be making my plug-ins only using the .Net Framework 3.0 (.Net Framework 2.0 and exploring with WCF, WPF and WF). Have fun and remember to test, debug and only deploy when you are confident that your plug-in and custom workflow are stable and reliable for production.

 

Abraham Saldaña --- Crmbuzz.net

posted @ Monday, January 14, 2008 3:11 PM | Feedback (0) |

Friday, January 11, 2008

CRM SDK available...

After much debate on moving my blog to another platform, I decided that at least keep blogging until my soul searching is complete...

This is the first post of the year, and at this time we have available the MS Dynamics CRM 4.0 SDK on the following public available location:

 

MS Dynamics CRM ASK 4.0

I wish for CRM 4.0 VPC could be also publicly located, and not be limited for partners, because I have not completed the partner certification...well that is my first year resolution.

 

At least you can play with the 90 day version:

 

Microsoft Dynamics CRM 4.0: 90-Day Trial Versions

 

Have fun with the SDK I will be posting some interesting things I found when converting some of my application to the new plug in model in CRM 4.0

 

Abe Saldaña

http://crmbuzz.net

posted @ Friday, January 11, 2008 1:44 PM | Feedback (0) |

Thursday, October 11, 2007

Titan CTP3 Beta Release available for all partners

If you are one of the Microsoft Dynamics CRM  partners now have the option to test and check out the new CRM version 4.0 Titan on a VPC downloadable file available via PartnerSource web portal. PartnerSource is a portal available to partners who focus on Microsoft Dynamics and related business products.

Microsoft Dynamics CRM 4.0: Virtual PC Image - CTP3 Beta Release (Requires login)

Si eres uno de los socios de Microsoft Dynamics Crm ahora tienes la opcion de hacer pruebas y ver la nueva version de CRM 4.0 llamada Titan on a VPC archivo que podras bajar del portal PartnerSource. PartnerSource is un portal disponible a los socios enfocados en Microsoft Dyanmics y en productions de negocio relacionados.

 

Abraham Saldaña

posted @ Thursday, October 11, 2007 3:29 PM | Feedback (0) |

Microsoft Office SharePoint 2007 List Web Part for Microsoft Dynamics CRM 3.0

Overview

The List Web Part for Microsoft Dynamics CRM 3.0 provides a subset of the Microsoft CRM record list functionality. It allows users to view Microsoft CRM records as a list from a SharePoint dashboard, open records in Microsoft CRM 3.0 from the list, and connect Microsoft CRM Web Parts to filter different lists.

 

The file CrmListWebPart.exe is a self extracting file. Download and save the file to a temporary folder. To extract the Web Part, double-click the file name or use the following command from a command prompt window

 

The List Web Part is now available in the following languages: English, Brazilian, Danish, Dutch, French, German, Italian, Spanish.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bc9b3526-decf-4057-a530-91840c0d5401

 

Have fun with SharePoint and CRM integration...

 

Abraham Saldaña

posted @ Thursday, October 11, 2007 3:08 PM | Feedback (0) |

Powered by: