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: Open-Source Software Is in Crisis IEEE Spectrum Artificial intelligence software at Zuckerberg S.F. General Hospital helps flag stroke risk San Francisco Chronicle DOD taps ‘integrated software enablers’ to help fully realize ambitious Replicator plans DefenseScoop London startup Agemo has exited stealth. Now, it's building AI reasoning for software to take on Poolside and Magic. Business Insider Keysight Providing Software to Enable Researchers through the Microelectronics Commons Business Wire Business Insider's Rating Methodology for Tax Software Business Insider RatedPower expands efficiency and precision with solar project design software release - PR Newswire AV Unveils Advanced Software Updates to Enhance Puma UAS Capabilities in Contested Environments Business Wire The Generative Software Cycle is Here: OutSystems Introduces the Power of Low-Code x AI Business Wire Schrödinger Announces Multi-Target Collaboration and Expanded Software Licensing Agreement with Novartis Business Wire Anduril Lattice Software Enhances US CENTCOM Air Defense Exercise The Defense Post TestSprite nabs $1.5M to build autonomous AI software testing platform SiliconANGLE News LEAP, globally popular software for energy, climate mitigation, and air pollution planning, to be offered free to an additional 54 countries Stockholm Environment Institute Salesforce Loses Top Artificial Intelligence Executive, Says Analyst Investor's Business Daily AI-based ARIA detection software could bring 'renewed hope' for people undergoing Alzheimer's treatment Health Imaging DMDE review: How good is this free data recovery software? Digital Trends Precisely Named a Leader in IDC MarketScape: Worldwide Data Intelligence Platform Software, 2024 Yahoo Finance EasyODM Launches AI-Powered Machine Vision Software Vision Systems Design Epic software helps veterans access VA benefits Verona Press Joget Earns GovStack Software Requirements Compliance ENGINEERING.com Enterprise Software in the Age of Generative AI GP Bullhound Fast 50 2024: Fearless aims beyond software after first acquisition The Business Journals Exclusive | FBI used ‘software tools’ to search social media for election-related talk: analyst New York Post Best Human Resources Software - 2024 Reviews & Pricing Software Advice Amundi buys wealth software firm Aixigo Financial News KIC Launches Game-Changing TAS Software Platform to Address Emerging Thermal Process Challenges AZoRobotics Take-Two Interactive Software Chief Financial Officer Lainie Goldstein Sells 35% Of Holding Simply Wall St Aviation Software Market Revenue to Attain USD 21.55 Bn by 2033 Precedence Research Samsung Galaxy S25 to offer 7 years of One UI software updates: Will you use it for that long? Sammy Fans Indian payments platform Razorpay launches B2B software fund - Global Corporate Venturing Danfoss Power Solutions launches ACL 3.2 software Industrial Vehicle Technology International PTV updates truck route-planning software Traffic Technology Today MSU, Web Software Engineer II, Bozeman Daily Chronicle From self-driving cars to AI that writes enterprise software: Cogna founder raises $15M - TechCrunch Montclair Council Passes Cell-Tower Ordinance, Tables Storm Water Regulation and Software Agreement TAPinto.net The Intellectual Property Software Market Reach USD 31.3 Billion by 2032 Growing with 15.6% CAGR EIN News Snyk founder’s Tessl raises $125M to revolutionise AI native software creation with spec-centric model Tech Funding News Danfoss software enables autonomous control Power Progress Forrester recognizes Black Duck as a Leader in software composition analysis Security Boulevard |
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 |