Software Information |
|
Microsoft CRM Customization - Programming Closed Email Activity
Microsoft CRM is CRM answer from Microsoft and attempt to get market share from Siebel, Oracle and others traditional Client Relationship Management System vendors. Microsoft CRM uses all the spectrum of Microsoft recent technologies: .Net, MS Exchange, MS Outlook, MS SQL Server, Replication, Indexing, Active Directory, Windows 2000/2003 security model, C#, VB.Net, HTML, XML Web Service, XLTP, Javascript to name a few. Today's topic is Activity of email type programming - you usually deal with these customizations when you improve Microsoft Exchange CRM connector. How do you create closed activity - this is the main discussion topic. We'll use C#.Net coding One of the roles of our Exchange Event Handler/Sink is creation MS CRM Closed Activity in handling incoming and outgoing email messages. The interaction with Microsoft CRM uses two approached - using MS CRM SDK (handling inbound and outbound XML messages) and via direct access to MS CRM Database. Let's first look at the Closed Activity creation algorithm: 1. First we need to understand the entity we need to create activity for: Account, Lead or Contact. The selection should use specific criteria - in our case this is email address: if ((crmAccount = crmConnector.GetAccount(mailboxFrom)) != null) { } else if ((crmContact = crmConnector.GetContact(mailboxFrom)) != null) { } else if ((crmLead = crmConnector.GetLead(mailboxFrom)) != null) { } 2. Then we have to get GUID of MS CRM user, who owns this entity, C# code like this: crmUser = crmConnector.GetUser(crmAccount.GetOwnerId()); 3. Next step is closed Activity creation: emailId = crmConnector.CreateEmailActivity( crmUser.GetId(), Microsoft.Crm.Platform.Types.ObjectType.otAccount, crmAccount.GetId(), Microsoft.Crm.Platform.Types.ObjectType.otSystemUser, crmUser.GetId(), crmAccount.GetEmailAddress(), crmUser.GetEmailAddress(), sSubject, sBody); 4. The method to create closed activity: public Guid CreateEmailActivity(Guid userId, int fromObjectType, Guid fromObjectId, int toObjectType, Guid toObjectId, string mailFrom, string mailTo, 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 += "" + mailTo + ""; if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otSystemUser) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + ""; } else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + ""; } else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + ""; } else if (toObjectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + ""; } strPartiesXml += ""+ toObjectId.ToString("B") + ""; strPartiesXml += ""; strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString(); strPartiesXml += ""; strPartiesXml += ""; strPartiesXml += ""; strPartiesXml += "" + mailFrom + ""; if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otSystemUser) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + ""; } else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otAccount) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() + ""; } else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otContact) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + ""; } else if (fromObjectType == Microsoft.Crm.Platform.Types.ObjectType.otLead) { strPartiesXml += "" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + ""; } strPartiesXml += ""+ fromObjectId.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(); } 5. To make the activity just created be shown correctly you need to setup it's flags according to MS CRM standards: 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); } } public void UpdateActivityQueueCodes(Guid emailId, Guid queueId) { try { OleDbCommand command = conn.CreateCommand(); command.CommandText = "UPDATE QueueItemBase SET Priority = (?), State = (?), QueueId = (?) WHERE ObjectId = (?)"; command.Prepare(); command.Parameters.Add(new OleDbParameter("Priority", Microsoft.Crm.Platform.Types.PRIORITY_CODE.PC_MEDIUM)); command.Parameters.Add(new OleDbParameter("State", Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_CLOSED)); command.Parameters.Add(new OleDbParameter("QueueId", queueId)); command.Parameters.Add(new OleDbParameter("ObjectId", emailId)); log.Debug("Prepare to update activity queue code " + emailId.ToString("B") + " in QueueItemBase"); command.ExecuteNonQuery(); } catch(Exception e) { log.Debug(e.Message + "" + e.StackTrace); } } Happy customizing, implementing and modifying! If you want us to do the job - give us a call 1-866-528-0577! help@albaspectrum.com About The Author Boris Makushkin is Lead Software Developer in Alba Spectrum Technologies - USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, Boston, San Francisco, San Diego, Los Angeles, Houston, Dallas, Atlanta, Miami, Montreal, Toronto, Vancouver, Madrid, Moscow, Europe and internationally (www.albaspectrum.com), he is Microsoft CRM SDK, C#, VB.Net, SQL, Oracle, Unix developer. Boris can be reached: 1-866-528-0577 or borism@albaspectrum.com.
MORE RESOURCES: Check Point Software Reports Fourth Quarter and 2024 Full Year Results Check Point Software DeepSeek AI Is 'Good News' For Enterprise Software, Says SAP CEO Investor's Business Daily Advisory details ransomware attacks on SimpleHelp remote access software American Hospital Association Honda issues recall over software glitch. Which vehicles are affected Lansing State Journal Guide to Legal Technology Software Bloomberg Law Exclusive: Apex Custom Software hacked, threat actors threaten to leak the software DataBreaches.net Honda recalls 295K vehicles for software issue KOBI-TV NBC5 / KOTI-TV NBC2 Clear-Com Unveils EHX v14 Software Update Sports Video Group Walmart has H&R Block tax software on sale for up to $16 off to save on filing your 2024 taxes NJ.com JONAS CLUB SOFTWARE UNVEILS INNOVATIONS & THE JONAS OPEN VIRTUAL GOLF TOURNAMENT AT THE 2025 CMAA CONFERENCE The Golf Wire Nearly 300,000 Honda and Acura Vehicles Recalled Over Faulty Software, Engine Stall Risks AboutLawsuits.com Managing the Risks of China’s Access to U.S. Data and Control of Software and Connected Technology Carnegie Endowment for International Peace Serco Expanding U.S. Business With Acquisition Of Northrop Grumman’s Training And Software Unit Defense Daily Network Honda recalls 295,000 vehicles due to software error that could cause engine to lose power USA TODAY Atlassian Earnings Beat. Software Maker's Revenue Guidance Above Views. Investor's Business Daily North Korean Lazarus hackers launch large-scale cyberattack by cloning open source software TechRadar Checkpoint Software (CHKP) PT Raised to $220 at Stifel StreetInsider.com QBS Software picks up Prianto ComputerWeekly.com SLK Software's promoters look to sell majority stake The Economic Times Checkpoint Software (CHKP) PT Raised to $220 at Mizuho StreetInsider.com PE Weekly: Deloitte Acquires ERP Software; Food and Beverage Deals Return Middle Market Growth Website Builder Software Market is projected to grow at USD 3.9 billion by 2032, CAGR with 7.9% EIN News KCS showcases its latest software at ARA Show International Rental News Cathie Wood Says Software Is the Next Big AI Opportunity -- 2 Ark ETFs You'll Want to Buy if She's Right The Motley Fool IBM Stock Pops On Earnings Beat, Software Growth, Free Cash Flow Outlook - Investor's Business Daily IBM Stock Pops On Earnings Beat, Software Growth, Free Cash Flow Outlook Investor's Business Daily SAP extends support deadline for getting off legacy software – in very special circumstances The Register Checkpoint Software (CHKP) PT Raised to $240 at Raymond James StreetInsider.com Checkpoint Software (CHKP) PT Raised to $220 at Cantor Fitzgerald StreetInsider.com IBM Is Seeing Growth in Software and AI Morningstar Appraisals for software engineers: Microsoft and Amazon are using performance reviews to decide who gets s The Economic Times Orchard Software Named Top LIS Vendor by 2025 Black Book Market Research for Seventh Consecutive Year PR Newswire Securing the Software Supply Chain: A 2035 Blueprint The New Stack American Honda Recalls 295,000 Vehicles in the U.S. to Update Fuel Injection Software Honda Newsroom Hg looks to raise $12bn for large-cap software bets Private Equity International Earthquake Alert Software Market May See a Big Move | Major Giants LastQuake,QuakeWatch,GEOFON openPR The toll Trump 2.0 could take on LatAm’s software, IT services exports BNamericas English Check Point Software Technology (CHKP) Tops Q4 EPS by 5c StreetInsider.com Check Point Software shares edge lower after Q4 results Investing.com Drone company's software will no longer stop flights over wildfires, other no-fly zones NBC San Diego Google open-sources the Pebble smartwatch’s software, and its creator is making a new model Engadget Startups to Watch 2025: VedaPointe's software automates workflow to improve health care The Business Journals HeartBeam submits 510(k) application to FDA for ECG software Medical Device Network Former Cruise engineers launch AI-powered design software startup Hestus The Business Journals Plus expands from self-driving to software-defined ADAS Automotive World How a Free Software Strategy Catapulted DeepSeek to AI Stardom The Wall Street Journal Accelerating software that helps the helpers BetaKit - Canadian Startup News |
RELATED ARTICLES
The True Meaning of Freeware The vast majority of us will have, at some point, had freeware games or applications installed on our systems. If you've played an online Java or Flash based game, you've used freeware. An Easy Way to Develop JAVA Enterprise Applications Research bears that less than 70 percent of development projects are actually completed, and more than half come in late and over budget. AlachiSoft TierDeveloper is a Rapid Application Development tool that helps Software Developers do better, more creative, and useful work by reducing redundant hand coding. Microsoft Great Plains Integrations - Retail Management Sample Microsoft Business Solutions is emerging as very attractive vendor for mid-size companies. The strength of its products is in their cross integration potential. Document Templates Give You The Perfect Framework For Your Documents When it comes to running an office, the SOHO entrepreneur has enough on his or her plate as it is. So if you find yourself in the unenviable position of regularly having to set aside your core competencies to handle tedious, repetitive administrative duties such as creating your business documents from scratch, then you need to consider the potential benefits offered by document templates. Putting Screensavers Under Control No matter how much you enjoy your favorite screensavers, sometimes they can be rather annoying. Don't like them interrupting your presentations? Hate them disturbing you watching movies? Look no further. These Items Are A Must Before Making The Decision To Purchase Any Off-The-Shelf Software 1. What determines the software price? Is it Per Seat or Per User or Per Processor?The cost of software is determined in many ways. Beware of Spyware One day, you suddenly realize that your computer started to worknoticeably slower than it used to. You decide to run de-fragmentation of your hard drive and add more virtual memory to the system. A Simple Computer Software Definition What is Software?Software is a set of instruction written to interface between man and machine.Who writes this instructions?Programmers writes this instructions. How to Choose the Right Accounting Software for Your Business With any good luck and a good amount of hard work, you'rehaving the same problem many business owners today arefacing. Your business is growing rapidly and you're havingproblems controlling your finances. Benefits of Integrating Online Chat Software with CRM Customer Relationship Management (CRM) is a strategy and processes used to learn more about customers' needs and behaviors in order to develop stronger relationships with them. CRM applications are traditionally developed as client-server software. Microsoft CRM USA Nationwide Remote Support Remember old good days when your company probably had Great Plains Dynamics? If you are in San Francisco Bay Area - you had local Great Plains Software partner consulting company, who served you basically coming onsite and charging you four hours minimum, even if the problem deserved 5-min fix? This was at the end of 20th century and remote support technologies were not very advanced - Citrix was making good progress and taking market over from Symantec PCAnywhere. Today, when Microsoft Terminal Server and Citrix are remote support standards and IT department uses them to host application server for nation-wide and world-wide users, you should probably be thinking of getting remote support for your ERP and CRM systems. Reloading Windows XP If you have been running Windows XP for a couple of years or more you may find that it is not running quite as quickly and smoothly as it was when you did your first install. I am constantly 'evaluating' software and uninstalling and reinstalling beta software on my computer and have always gradually become more and more disappointed after nine months to a year with the performance of my PC. How to Evaluate Staffing Software If you are in the market for new staffing software, I suspect that one of the most daunting of tasks will be to sift through the many vendors that are now servicing the staffing industry.You will find many very qualified companies with good staffing software products. Free Software: How Not To Get More Than You Bargained For! I completed an experiment recently. I wanted to find out exactly what software I could get free on the Internet. EDI: Electronic Document Interchange for Microsoft Great Plains - Overview for Software Developer/Pr Microsoft Great Plains - Microsoft Business Solutions accounting and ERP system, originally targeted to mid-size - now, with advancements and increasing reliability of its database - Microsoft SQL Server, Great Plains is attractive solution for large corporation. Big companies usually have purchasing and order processing automation via so-called Electronic Document Interchange or EDI. Does your Company have Documentum? Are you lost in the mess of documents that get passed around your company, never knowing what the latest version is and which one you should work on without worrying if someone else has already made the same editions that you are making? Perhaps you have heard of collaboration software solutions such as Documentum to help your company manage its documents that are passed around. Documentum is a very good solution to this problem but is it the only one? In this article you will be presented with some basic information about the differences in collaboration software from Documentum and NextPage. Microsoft CRM for Corporate Business - Working Offline If your company has regional and worldwide operations, you might already realized that it is very hard to get decent internet connection in your remote locations. In this small article we will try to give you highlights on how to implement Microsoft Business Solutions CRM for worldwide operations with restricted internet connection. PHP On-The-Fly! IntroductionPHP can be used for a lot of different things, and is one of the most powerful scripting languages available on the web. Not to mention it's extremely cheap and widely used. Great Plains Sales Order Processing and Invoicing Modules - Tips For Consultants We'll give you non formal view, based on our consulting practice.Common Features. Microsoft Great Plains Customization Recovery & Upgrade for Large Corporation At the end of XX century, in the late 1990th Great Plains Software eEnterprise was recognized as one of the leader on the midsize to large corporate ERP market. Due to the nature of eEnterprise architecture - it is Great Plains Dexterity based application and Dexterity imposes some specific to the database access and table structure - eEnterprise was subject to relatively inexpensive customization. |
home | site map |
© 2006 |