Software Information |
|
Microsoft CRM Customization Secrets ? Second Edition
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: 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! [email protected] 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; [email protected]
|
RELATED ARTICLES
DVD Burning Tips CD and DVD replication is a process that works by creating discs from scratch. Not to be confused with duplication (the act of burning information onto readymade, commercially-available blank CD-Rs and DVD-Rs), replication relies on the use of molds to produce actual discs that already contain digital data. It is the preferred and recommended mode of mass production for quantities in excess of 500 units. Kick-Ass Performance For Your PC? Its Easy Is your PC is slow and wimpy? Then you need some PC steroids - software applications that will cleanse the registry, optimize RAM and make that puppy fly. Here is what you should start with. Great Plains Dexterity History and Programming Overview As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into Microsoft Great Plains and Microsoft Business Solutions is in process of merging all its accounting applications: Great Plains, Solomon, Navision and Axapta into somewhat granular: Microsoft Financials, Microsoft HR, Microsoft Distributions, Microsoft Project Accounting, etc. So the original design of Great Plains should be deemphasized. But even now - Great Plains is written on the programming language and technology, created in early 1990-th, named Great Plains Dexterity. And the graphical interface looks very user friendly and nice - these are all Dexterity forms and screens. Reduce Pop-ups and Annoying Ads There is many things more frustrating than surfing a website only to have your screen suddenly full of pop-up advertising or a cascade of new windows opening. There are so many intrusive kinds of advertising on websites that there must be a way to deal with them. Luckily for us there is a few programs out there that will help to reduce the amount of advertising that happens while you surf. Microsoft Great Plains e-Commerce ? additional considerations for programmer Microsoft Great Plains, designed back in 1990th as database transferable and graphical platform independent ERP application ? Great Plains Dynamics/Dynamics C/S+/eEnterprise. For eCommerce developer the most important is to understand Great Plains tables structure and business processes in Sales Order Processing, Accounts Receivables, Inventory Control (inventory items allocation, backordering, etc), posting to Bank Reconciliation and General Ledger. And this is where Great Plains structure seems to be not transparent. Let's give you highlights: Microsoft Great Plains Customization Tools ? Overview Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions Great Plains was initially designed in the earlier 1990th as the extendable and modular application with its proprietary tool: Great Plains Dexterity, written in C programming language as a shell. This was popular tendency those days ?compare with SAP ABAP or Navision C/Side. Great Plains has additional ideas ? database platform independence and graphical platform independent interface (initially targeted to both Apple Macintosh and Microsoft Windows with good chance that one of them will take market over ? and it did happen, including the acquisition of Great Plains Software by Microsoft). In this small article we'll give you revised overview ? you can find previous publication in the last year posts. OSI Layers Model Introduction Microsoft Great Plains FA: Fixed Assets ? Overview For Consultant Great Plains Fixed Assets Management module is a robust tool that can help you manage your assets effectively. It integrates perfectly with other Great Plains modules like General Ledger, Purchase Order Processing, and Payables Management ensuring accuracy while reducing redundant data entry. An Easy Way to Deal with Email Viruses and Worms If you feel intimidated when someone tries to teach you something new on the computer, this article is for you! 10 Programming Tips (1) Avoid using the same variable again and again for different purposes. Online PowerPoint Presentation ? Convert PowerPoint to Flash Although we don't know whether Microsoft ever envisioned such a big market about PowerPoint on its first release. Today this software is impacting profoundly on education and corporation's activities in the way that nobody could ignore. With a wealth of visual and audio effects people rely on it to express their ideas, plans more intuitively with more effective communication outcomes. Snort for Network IDS What is Snort? My Experience - Making a Vision into Reality Disclaimer: All the thoughts expressed are my views only! Your perception might differ... IT Strategy for Large Corporation: ERP/MRP/CRM, Unix/Linux/Windows, Microsoft/Java Combining Microsoft Business Solutions Great Plains ERP with non-Microsoft Business System or CRM: Lotus Notes Domino, Oracle, DB2 Fleet Maintenance Software Reviews Innovative Maintenance Systems (IMS) is one company that offers solutions for companies in need of fleet maintenance software. One of their most popular products is Fleet Maintenance Pro�. According to the website and fleet maintenance software reviews, this product offers automatic calculations of maintenance, assists in tracking PM and repair maintenance, helps you analyze fleet costs over time and much more. This product is recommended for maintaining vehicles that are tracked by date, mileage, hours and etc. Prices range from $189.00 - $750.00 for single users, but networking capabilities are also available. 6 Easy Steps for a Smoother CD/DVD Order It's all about turn times in the eMedia industry! The speed with which your vendor can get your CD or DVD project completed is vital to many customers. However, responsibility for these projects meeting their completion dates starts with the customer and ends with the vendor. It's a partnership that shares the responsibility. Just follow the 6 easy steps below: Microsoft Great Plains SOP: Sales Order Processing 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). Microsoft RMS Customization ? PO Items Receiving in Great Plains Microsoft Retail Management (RMS) and Microsoft Great Plains are retail and accounting/ERP solutions coming from the same Microsoft subdivision ? Microsoft Business Solutions. There is often common need to do integration between the two. Despite the fact that both systems come from the same software development company ? the integration is not as simple as it probably should be. Are You Waiting for Microsoft Longhorn Operating System I love new technology. I am still ready to wait long for Longhorn. I have tried almost all operating systems of Windows series. My interest in Longhorn is building up day by day and the reason is..! From beginning Microsoft is very successful to project Longhorn as something mysterious. Many interesting stories are connected with it, which helped Longhorn to gain pre-launch popularity; I would rather say curiosity about this product. I don't know who is the propaganda minister of Microsoft? May be Mr. Brightside or Mr.Lonely. Relax guys I was just kidding. Seven Reasons Why a Hosted Inventory Management Solution Might Be Right For Your Organization Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of headaches related to the implementation and on-going care-and-feeding of enterprise based applications is enough make the savviest of companies want to engage in anything but another software implementation. Like a full-blown IRS audit. Anything? |
home | site map |
© 2005 |