Tuesday, December 14, 2004

Microsoft CRM Customization -- Programming Closed Email Activity

A Neat thing I found on Microsoft CRM Customization -- programming Closed Email Activity

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 objectMicrosoft.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 objectMicrosoft.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 activitystring strActivityXml = ";strActivityXml += ";strActivityXml += ") + "]]>";strActivityXml += ";strActivityXml += userId.ToString("B") + ";strActivityXml += ";// Set up the XML string for the activity partiesstring 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 objectGuid 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 + "\r\n" + 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 + "\r\n" + 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 + "\r\n" + e.StackTrace);}}

Source : http://www.articlecity.com/


Tuesday, December 07, 2004

Heat and Crystal Sub Reports

There appears to be a bug in All versions of HEAT 8 (including the newly released HEAT 8.03) It causes Call Logging to GPF when running a custom report with one or more sub-reports.
When you run a report from the Report menu in Call Logging and then close the report after viewing the details it causes Call Logging to crash with a CallLog32.exe error.

There appears to be no work around at this point although it has been logged as a bug.

Monday, December 06, 2004

Goldmine and the BDE

Goldmine Setup
--------------

- if it doesn't find a local bde installation (usually denoted by idapi32.dll)
it will setup the BDE registry entries in
HKLM\SOFTWARE\Borland\Database Enginepointing to the version of BDE from where setup is run (in this case on the Goldmine drive)

- if it does find a local bde installation, it will attempt to merge the Goldmine settings
(stored in ..\BDEShare\IDAPI32.cfg) with the setting of those of the local installation.
(IDAPI32.cfg in the local BDE folders)

- Additionally Setup creates three ODBC connections:
GMSales_Mktg
GMSales_Mktg System
ManCon Metric Log (Used when Goldmine is integrated with HEAT)

These connections are setup mainly for the user'c convenience when building reports. If no applications or reports depend on them, they can be safely deleted.

To manually run BDE - (Run BDEADMIN.exe from file:////GoldmineServer/GoldmineShare/Setup/BDEShare)
or C:\Program Files\Common Files\BDEShare)

When Goldmine was initially installed, the BDE engine was configured to include the
following MSSQL Aliases:

Goldmine These are 'MSSQL aliases' pointing back to the server directly
Goldmine_Test (ie not ODBC dependant)

These describe where the Goldmine databases are sitting
eg Config Settings:
Server Name: DatabaseServer
Database Name: Goldmine
User Name: sa (must be a specifed username - cannot use Windows pass-through)
... etc

These settings can be edited manually, however as it is in binary format, it cannot easily be parsed through scripting. The entire file can be migrated between systems to transfer these settings. And is prone to corruption

- The BDE engine 'absorbs' ODBC connections present on any machine it is running on, and creates equivalent BDE Aliases - such that BDE applications can access data through ODBC connections.
These connections, in addition to 'pure' BDE aliases are stored entirely within Idapi32.cfg

Each BDE Alias is self contained with regards to database parameters and connectivity settings / optimisations eg: BLOB SIZE

- The BDE also requires registry entries which describe where the BDE engine and IDAPI32.cfg is sitting:

[HKEY_LOCAL_MACHINE\SOFTWARE\Borland\Database Engine]
"DLLPATH"="g:\\setup\\bdeshare"
"CONFIGFILE01"="g:\\setup\\bdeshare\\idapi32.cfg"

and also any database drivers that are loaded .... (various keys beneath the parent Database Engine Key)


Running Goldmine
----------------

- Username is extracted from Windows environment variables. The 'User.dbf' dbase file is checked from within the Goldmine program directory to see whether the current username exists in the file (with a blank password).
If the user exists, and the password is blank, the goldmine load process will continue
If the user does not exist, or the password is not blank, it will prompt
- Then the local Registry is checked for BDE settings
- IDAPI.DLL and CFG are searched for in location specified in registry - bombs out if it can't find them
- Checks GM.INI in the Server Program file directory for entries like the following:
[GoldMine]
GoldDir=MSSQL: GoldMine: dbo:
CommonDir=MSSQL: GoldMine: dbo:

This specifies which alias to use in the BDE engine when connecting to the database
- It resolves the two aliases
(GoldDir - Goldmine internal Database structure - screen layouts, etc)
(CommonDir - User Data portion of database)
This means the application and User Data portions of the database can be run on seperate servers if rqd
- Looks to the Goldir Alias, for (amongst others) a table called SPFILES
(This table is created through the front end, whenever new Goldmine databases are created)
It contains information similar to the following:

DIRNAMEDIRPATHUSERIDDIRCODEDBPASSWORDDRIVER
Goldmine ProductionMSSQL: Goldmine: dbo:12producGMSQLEncrypted PasswordMSSQL


It then follows the entries in the DIRPATH column depending on what matches the entries from GM.INI for CommonDir
If there is no match, or multiple matches, Goldmine will prompt for the database to be used, otherwise it will
a

Once the database has been resolved, the application then verifies the current user logon details against the USERID
column. The USERID column contains a Goldmine application group which controls application security

The current architecture for Goldmine is such that the BDE Settings in the registry of each local machine point to the BDE files on the Goldmine server. NOTE This CAN be a UNC path

On systems with PA Report Query or other applications that utilise BDE, conflicts may occur if any of the above configuration is modified. It should be possible to make apps co-exist with Goldmine so long as the above configuration is honoured.


Tuesday, November 30, 2004

Heat Self Service (HSS) and Windows 2003 Server

I encountered a few issues with HSS (Frontrange's Customer Web component for HEAT) installing on Windows 2003 server so I thought I'd post up the steps to getting operational.

Before you Install
Remove the Internet Explorer Enhanced Security Configuration Component from Control Panel->Add Remove Programs->Add/Remove Windows Components.

Post-Installation changes
You may find that the Virtual Directories will not have been created. These will have to be created manually.

Post-Installation changes to the name and/or location of the HEAT Self Service web site
This is most likely necessary when then Virtual Directories haven't been automatically installed. If this is the case you will receive this error when trying to load the Admin.asp page

Active Server Pages error 'ASP 0126'
Include file not found
/HEATSelfService/HEATSelfServiceAdmin/admin.asp, line 167
The include file '../csswebsite/common/header.html' was not found.

When making post-installation changes to the name of the physical directory that contain the
HEAT Self Service web site, it is necessary to make changes to an include directive that is
located in "admin.asp", a file which is located in the HEAT Self Service Administrator’s web site.
The HEAT Self Service Administrator’s web site is a virtual directory that can be found
underneath the HEAT Self Service web site in the Internet Information Services control tool.
Following installation of HEAT Self Service, the include directive typically looks like this:



This directive allows the HEAT Self Service Administrator’s site to display and edit the contents of the HTML header file that appears at the top of all HEAT Self Service web site pages. The
include directive that is shown above looks into a physical directory named "heatselfservice" for
the header file. If this directory name is changed at any point after a successful HEAT Self
Service installation, then this include directive must also be changed to match the new name of
the physical directory that contains the HEAT Self Service web site. This include directive
appears twice in the file "admin.asp" so both instances of it must be updated.

Security Changes Needed for HSS Operation
Adminsitrators will need to make changes to the Windows security in order for HSS to operate.
The changes needed are:
1. The iUSER account must have "List Folder Contents" rights on the root drive where HSS
is installed.
2. The iUSER account must have "Read & Execute" rights on the HEAT folder where HSS
is installed.
3. The iUSER account must have "Read, Write, and Execute Rights to the HEAT/Data
folder ONLY if using the Access database stored in that directory.

Changes Needed to IIS if installing on Windows Server 2003
HSS requires changes to IIS 6.0 after installation to ensure proper operation on Windows Server
2003. The changes needed are:
1. Open Internet Information Services Manager.
2. Browse to Web Server Extensions.
3. Highlight Active Server Pages, then click Allow.
4. Browse to Web Site.
5. Right-Click on Web Site, then click Properties.
6. Select the Service tab
7. Check the Run WWW service in IIS 5.0 isolation mode option under the Isolation Mode
section.
8. Browse to the HSS virtual directory
9. Right-click, then select Properties
10. In the Application Settings section of the Virtual Directory tab, Click Configuration.
11. Select the Options tab
12. Check Enable Parent Paths option.
13. Click OK.

Default Page for HSSAdmin Virtual directory
HSS installs the HSSAdmin Virtual directory under the HSS virtual directory. The default web
page for this virtual directory is set to default.asp. The default web page must be changed to
Admin.asp.

Monday, November 29, 2004

Useful SFO Links

How to Turn On Replication and to Create a Publication in Microsoft CRM (829504)
https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;en-us;829504

The reinstall of Microsoft CRM Server after the existing databases have been moved to a different instance of SQL Server requires manual replication reconfiguration (861878)https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;en-us;861878

Microsoft SQL replication and the Microsoft CRM Sales for Outlook synchronization process

(870114) This article discusses Microsoft SQL replication and when it occurs during the Microsoft CRM Sales for Outlook synchronization process

SQL Server Replication Snapshot is Not Created in SQL Enterprise Manager for Microsoft CRM

(860064) SQL Server Replication Snapshot is not created in SQL Enterprise Manager for Microsoft CRM.


Replication is not created after a successful install of Microsoft CRM Server

(859642) Replication is not created after a successful Microsoft CRM Server installation.

Replication Monitor Group Does Not Appear in SQL Server Enterprise Manager After You Install Microsoft CRM

(829531) After you install Microsoft Business Solutions CRM, the Replication Monitor group does not appear in SQL Server Enterprise Manager

How to recreate replication and enable publishing for Microsoft CRM Sales for Outlook when offline synchronization fails

(872585) This article discusses how to re-create replication and enable publishing for Microsoft CRM Sales for Outlook after the client has failed with its initial Synchronization.

How can I add a graphic to an E-mail Template in Microsoft CRM?

  • Microsoft CRM e-mail templates are HTML and browser-based, so you must beable to display the graphic in a browser.
  • Graphics are not embedded or attached, they are only a link placed in thefile pointing to where the actual graphic is located.
  • The graphic must be on a Web site that the e-mail recipient can access.

To add a graphic to an e-mail template:
1. On the Microsoft CRM Homepage, click Settings, click Template Manager,and then click E-mail Templates.
2. On the Actions bar, click New E-mail Template.
3. Select a template type and click OK.
4. Complete the details of the e-mail template.
5. Open the Web page (using Internet Explorer) or Web site folder (usingWindows Explorer) that contains the graphic. Usually all the graphics for aWeb site are located in one folder. Links to the graphics in this folder arethen placed in the Web files.
6. Copy and paste the graphic to your e-mail template. Although the graphicwill appear, you have copied and pasted only the link to that graphic.
7. Save the e-mail template, and test sending out an E-mail using the E-mail template.

Friday, November 26, 2004

CRM1.2 CDF Error - "The version of the CDF database..."

I’ve come across this error a couple of times when trying to run a CDF initialize.
When running the CDF initialization executable you receive the following error message:
The version of the CDF database you are attempting to use does not match the version of your Microsoft CRM database.

It comes from problems with language versions on the CRM server and the CDF installation. The following patch fixes the issue but it is very difficult to find from the MS Website and many of the links to the file go to other CRM patches.
http://www.microsoft.com/downloads/details.aspx?FamilyID=0c3f1734-23e2-4e60-a42d-01a36a9f9831&DisplayLang=en

Wednesday, November 24, 2004

Frontrange in the News

FrontRange Solutions Launches IP Contact Center 3.7; Latest ...Business Wire (press release), CA - 12 hours ago23, 2004--FrontRange Solutions, an international leader in Service Management, Customer Relationship Management (CRM) and customer contact technology, today ...
FrontRange's HEAT solution keeps University of Western Cape ...ITWeb, South Africa - 19 Nov 2004... For more than 2 500 academic and administrative users of information technology (IT) at the University of the Western Cape (UWC), FrontRange Solution's mid ...
FrontRange Named to Software 500 ListTMCnet - 10 Nov 2004After posting record-setting results for its fiscal year 2004, FrontRange Solutions, the global leader in Service Management and Customer Relationship ...
FrontRange Achieves Highest PinkVerify Certification for New ITSM ...TMCnet - 29 Oct 2004... 29, 2004 -- FrontRange Solutions, a global leader in Service Management and Customer Relationship Management (CRM) software solutions for small to mid-sized ...

Changing the Date/Globalisation Settings on CRM Servers

Web Forms configuration files, named Web.config, provide settings for every Web Forms page in the same directory as the configuration file. The settings are usually also inherited by subdirectories. Each file can contain a globalization section in which you can specify default encodings and cultures. Values are valid if they are accepted by the related Encoding and CultureInfo classes.

Set the values of culture and uiCulture.



fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
uiCulture="de-DE"
/>


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskeditingwebconfigfileforwebformsglobalization.asp


Starting CRM development

So looking to start creating CRM Custom Integrations I thought I'd post a link from MSDN with all the details of CRM Post Callouts etc.

MSDN Article

First CRM thingy

Well I had to start somewhere and as I was playing with the ISV.CONFIG yesterday I thought it was appropriate to post some details on the file.

I found the Article What do the ISV.config & WEB.config files do? from mscrm.com.au was a great place for your first introduction into the Config files. It gives you a basic layout to the XML structure and how to add extra items to both global areas and object areas.