Software

Software - All The Information You Need On Software

Microsoft Crm Customization Secrets ? Second Edition


Software

This article is for advanced Microsoft CRM SDK C# developers. It describes the technique of direct SQL programming, when SDK doesn't have the functionality to do the job.

Introduction. Looks like Microsoft CRM becomes more and more popular, partly because of Microsoft muscles behind it. Now it is targeted to the whole spectrum of horizontal and vertical market clientele. It is tightly integrated with other Microsoft Business Solutions products such as Microsoft Great Plains, Solomon, Navision (the last two in progress).

Here we describe the technique of creating closed activity-email using MS CRM SDK and direct SQL programming.

Imaging something like this. You need to handle incoming email before it is committed to MS Exchange database. You need to analyze if incoming email doesn't have GUID in its Subject (GUID will allow MS CRM Exchange Connector to move email to Microsoft CRM and attach it to the Contact, Account or Lead) - then you still need to lookup MS CRM in case if one of the accounts, contacts or leads has email address that matches with sender email address - then you need to create closed activity-email in MS CRM, attached to the object and placed into general queue.

How to create MS Exchange handler is outside of the scope, please see this article:


http://www.albaspectrum.com/Customizations_Whitepapers/Dexterity_SQL_VBA_Crystal/ExchangeHandlerExample.htm

Now the code below is classical MS CRM SDK and it will create activity email:

public Guid CreateEmailActivity(Guid userId, int objectType, Guid objectId, string mailFrom, CRMUser crmUser, string subject, string body) {

try {

log.Debug("Prepare for Mail Activity Creating");

// BizUser proxy object

Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser();

ICredentials credentials = new NetworkCredential(sysUserId, sysPassword, sysDomain);

bizUser.Url = crmDir + "BizUser.srf";

bizUser.Credentials = credentials;

Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

// CRMEmail proxy object

Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();

email.Credentials = credentials;

email.Url = crmDir + "CRMEmail.srf";

// Set up the XML string for the activity

string strActivityXml = "";

strActivityXml += "";

strActivityXml += "") + "]]>";

strActivityXml += "";

strActivityXml += userId.ToString("B") + "";

strActivityXml += "";

// Set up the XML string for the activity parties

string strPartiesXml = "";

strPartiesXml += "";

strPartiesXml += "" + crmUser.GetEmailAddress() + "";

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + "";

strPartiesXml += ""+ crmUser.GetId().ToString("B") + "";

strPartiesXml += "";

strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();

strPartiesXml += "";

strPartiesXml += "";

strPartiesXml += "";

strPartiesXml += "" + mailFrom + "";

if (objectType Microsoft.Crm.Platform.Types.ObjectType.otAccount) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + "";

}

else if (objectType Microsoft.Crm.Platform.Types.ObjectType.otContact) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "";

}

else if (objectType Microsoft.Crm.Platform.Types.ObjectType.otLead) {

strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + "";

}

strPartiesXml += ""+ objectId.ToString("B") + "";

strPartiesXml += "";

strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_SENDER.ToString();

strPartiesXml += "";

strPartiesXml += "";

strPartiesXml += "";

log.Debug(strPartiesXml);

// Create the e-mail object

Guid emailId = new Guid(email.Create(userAuth, strActivityXml, strPartiesXml));

return emailId;

}

catch (System.Web.Services.Protocols.SoapException e) {

log.Debug("ErrorMessage: " + e.Message + " " + e.Detail.OuterXml + " Source: " + e.Source);

}

catch (Exception e) {

log.Debug(e.Message + "" + e.StackTrace);

}

return new Guid();

}

Our credits to Anna Osborn (so obviously small pocket aquarium goes to her ? smile!), she let us know how to close MS CRM Activity:

//creates the activity

strActivityId = oActivity.Create(userAuth, strXml, activityPartyXml);

//closes it as long as the relevant fields are complete oActivity.Close(userAuth, strActivityId, -1);

But in any case whatever you find below could help you to do whatever CRM SDK can't.

Now I would like to share the trick with you - there is no method to make this activity closed in MS CRM SDK 1.2 (if somebody knows the one - I owe you small pocket aquarium - smile!). Obviously Microsoft doesn't support if you do direct SQL programming bypassing SDK. However I would say this is not direct objects creation - this is rather flags correction. So here is what we have - this procedure will do the job and make activity closed:

public void UpdateActivityCodes(Guid emailId) {

try {

OleDbCommand command = conn.CreateCommand();

command.CommandText = "UPDATE ActivityBase SET DirectionCode = (?), StateCode = (?), PriorityCode = (?) WHERE ActivityId = (?)";

command.Prepare();

command.Parameters.Add(new OleDbParameter("DirectionCode", Microsoft.Crm.Platform.Types.EVENT_DIRECTION.ED_INCOMING));

command.Parameters.Add(new OleDbParameter("StateCode", Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_CLOSED));

command.Parameters.Add(new OleDbParameter("PriorityCode", Microsoft.Crm.Platform.Types.PRIORITY_CODE.PC_MEDIUM));

command.Parameters.Add(new OleDbParameter("ActivityId", emailId));

log.Debug("Prepare to update activity code " + emailId.ToString("B") + " in ActivityBase");

command.ExecuteNonQuery();

}

catch(Exception e) {

log.Debug(e.Message + "" + e.StackTrace);

}

}

Happy customizing! if you want us to do the job - give us a call 1-866-528-0577! help@albaspectrum.com

About The Author

Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies ? USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, Arizona, California, Colorado, Texas, New York, Georgia, Florida, Canada, UK, Australia and having locations in multiple states and internationally , he is Dexterity, SQL, C#.Net, Crystal Reports and Microsoft CRM SDK developer; akarasev@albaspectrum.com







Computers Software   |   Computers Web Design   |   Computers Web Development   |   Computers Web Hosting



| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |











Microsoft Great Plains: Getting New Users Licenses ? Annual Service Plan Faq
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM require existing customer to be ...(related: Software)


Spyware Statistics -- Whats New In May 2005?
Although statistics often is blamed for various deadly sins -- from being biased to being inaccurate -- there is nothing left to those who are anyhow connected with IT but to keep up with fresh data. Since spyware is literally ubiquitous, nobody who owns or uses a PC can say that it is none of his business. So general public also has to keep an eye on the news about spyware.On May 3 Webroot Software, a privately held anti-spyware company based in Boulder, Colorado, released a comprehensive...(related: Software)


Guide To Software Marketing
IntroThis concise article will tell you in plain English how you can promote your software easily and effectively.Submit your softwareI recommend submitting your software to upload.com. It costs $79 dollars a year, but is well worth it. It will display your product on download.com and its partner network made up of 20 other major download sites. Download.com is so popular that if your product was only listed on download.com it would still be worth the yearly fee.Use Rudenko's (submit.rudenko.com) software submission service to submit your software to hundreds of software archives. Unlike auto-submit programs, Rudenko has employees manually submit your software to each archive so it is l...(related: Software)


Resume Software ? Advantages Revealed
The various resume software offered, particularly on the internet, can seem very attractive to job seekers; especially to those not comfortable writing resumes. At first glance resume writing software can provide a number of perks and can appear to be the perfect solution to many job seekers.There are some disadvantages to using software, however; and before utilizing it to create a resume, a wise job seeker will take a few moments to compare both the advantages and the disadvantages of resume software.Software for writing resumes is also commonly known as resume writers, resume creator, resume maker and resume builder.Advan...(related: Software)


Reduce Tco: The Java Database Way

TCO (Total Cost Ownership) is the buzzword in today's business world. This metric helps enterprise managers assess direct and indirect costs and benefits derived from their investment on IT components and services. A...(related: Software)

Microsoft Great Plains Gl: General Ledger ? Overview For Consultant
Microsoft Business Solutions Great Plains is marketed for mid-size companies as well as Navision (which has very good positions in Europe and emerging markets where it can be easily localized). Great Plains...(related: Software)


How To Tell You Have Spyware, Ad-ware Or Viruses
Usually, the easiest way to tell you have spyware is because your PC is running at a reduced speed. The other way to check is to hit CTRL+ALT+DELETE and hit task manager (if you have windows service pack 2. If you have before SP2, then this should automatically bring up the task manager).Once the task manager is open, check your running processes under the "Processes" tab. If you see a lot of strange processes running you don't recognize, you likely are infected with spyware, ad-ware or viruses.An example of strange processes would be a fg...(related: Software)




Google




Choose Your Java Wisely

Java has come along a long way.  Many would agree with this.  I did not until the Java 1.5 "Tiger" hit me.  The tiger had several new features, and more importantly, it has new syntax.  Six major upgrades that the tiger presents are certainly the generics, enhanced for loop, autoboxing (unboxing), improvement on Typesafe enum, Static import and the metadata.  Of course there are many more, which can be found at java's official site.  Out of these six, at least four would be used in my daily "programming" life.  From java 1.1 to 1.4, it seemed more like new frills were simply added.  It felt like earning more brownie points when you downloaded the newer version.  But should I start using 1.5 immediately, maybe not.

The developers and programmers (if you distinguish between them) are ...(related: Software)

Crystal Reports For Microsoft Great Plains ? Overview For Developer

Microsoft Great Plains is main accounting / ERP application from Microsoft Business Solutions, targeted to the US market.  It serves the whole of vertical and horizontal market: most of the industries and company sizes.  Crystal Reports on the other hand is the leader in the reporting software industry and Microsoft is willing to use Crystal as main reporting tool for Great Plains, Solomon, Microsoft CRM, .Net platform, etc.

If you are developer who is...(related: Software)

C++ Tutorial 2, Input And Variables
This is the tutorial where we really get into programming. Input and variables are the essence of programming. In this tutorial you will learn how to get data from the user and use variables. You will learn the types of variables there are and how to do basic math with them. At first, this may seem boring and pointless, but you have to learn it, and it should go quick.Basic InputWhen you are making a console application, here is how you should get user input. Some of you may have guessed it, you use c[b]in[/b], of course, the 'c' meaning console and the 'in' meaning input, like 'cout'. So, here is a basic code, where the name of the variable x.cin>>x;Defining Varia...(related: Software)

site-map - Copyright © 2008 | Contact Webmaster | All Rights Reserved. | Software