Microsoft CRM Customization- Software Closed Email Activity

페이지 정보

profile_image
작성자 Magda
댓글 0건 조회 57회 작성일 24-05-05 22:53

본문

Microsoft's CRM is a traditional client relation management system vendor, competing with Siebel, Oracle, and customization people. Microsoft CRM uses all the range of Microsoft new solutions:. Online, MS Exchange, MS Outlook, MS SQL Server, Replication, Indexing, Active Directory, Windows 2000/2003 safety design, C#, VB. Online, HTML, XML Web Service, XLTP, Browser to name a few.

Exercise of email type programming is the topic of yesterday's discussion; you typically deal with these customizations when Microsoft Exchange CRM connection is improved. This is the main conversation matter, and how do you create closed activities? We'll apply C#. Online programming

In handling both incoming and outgoing emails, one of our Exchange Event Handler/Sink's tasks is to create MS CRM Closed Activity. Using the MS CRM SDK ( handling inbound and outbound XML messages ) and direct access to the MS CRM Database, the interaction with Microsoft CRM takes two forms. This first look at the Finished Action design engine:

1. First we need to know the object we need to make activity for: Account, Lead or Contact. The choice may use a particular set of criteria, such as email address, in our event:

if ( ( crmAccount = crmConnector. GetAccount( mailbox From ) )! = null )

}

else if ( ( crmContact = crmConnector. GetContact( mailbox From ) )! = null )

}

else if ( ( crmLead = crmConnector. GetLead( mailbox From ) )! = null )

}

2. Then we have to find GUID of MS CRM users, who owns this object, C# script like this:

crmUser = crmConnector. GetUser( crmAccount. GetOwnerId( ) );

3. Next stage is closed Exercise development:

emailId = crmConnector. CreateEmailActivity (

crmUser.GetId(),

Microsoft. Crm. Program. Forms. ObjectType. otAccount, crmAccount. GetId( ),

Microsoft. Crm. System. Forms. ObjectType. otSystemUser, crmUser. GetId( ),

crmAccount. GetEmailAddress( ), crmUser. GetEmailAddress( ), sSubject, sBody );

4. The process to create closed action:

public Guid CreateEmailActivity( Guid userId, int fromObjectType, Guid fromObjectId, int toObjectType, Guid toObjectId, string mail From, string mailTo, string subject, string body )

try

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

// BizUser proxy thing

Microsoft. Crm. System. Vpn. BizUser bizUser = fresh Microsoft. Crm. Program. Vpn. BizUser( );

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

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

bizUser. Qualifications = qualifications;

Microsoft. Crm. Program. Surrogate. CUserAuth userAuth = bizUser. WhoAmI( );

// CRMEmail proxy image

Microsoft. Crm. Software. Surrogate. CRMEmail internet = fresh Microsoft. Crm. Software. Vpn. CRMEmail( );

message. Qualifications = qualifications;

contact. Url = crmDir + "CRMEmail. fs";

// Laid up the XML series for the task

strActivityXml ="" in series;

strActivityXml + ="";

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

strActivityXml + ="";

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

strActivityXml + ="";

// Laid up the XML series for the task parties

strPartiesXml ="";

strPartiesXml + ="";

strPartiesXml + ="" + mailTo +"";

if ( toObjectType = = Microsoft. Crm. Software. Forms. ObjectType. otSystemUser )

strPartiesXml + ="" + Microsoft. Crm. Program. Forms. ObjectType. otSystemUser. ToString( ) +"";

}

else if ( toObjectType = = Microsoft. Crm. Program. Forms. ObjectType. otAccount )

strPartiesXml + ="" + Microsoft. Crm. System. Forms. ObjectType. otAccount. ToString( ) +"";

}

else if ( toObjectType = = Microsoft. Crm. Program. Forms. ObjectType. otContact )

strPartiesXml + ="" + Microsoft. Crm. System. Forms. ObjectType. otContact. ToString( ) +"";

}

else if ( toObjectType = = Microsoft. Crm. Program. Forms. ObjectType. otLead )

strPartiesXml + ="" + Microsoft. Crm. Software. Forms. ObjectType. otLead. ToString( ) +"";

}

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

strPartiesXml + ="";

strPartiesXml + = Microsoft. Crm. Program. Forms. ACTIVITY_PARTY_TYPE. ACTIVITY_PARTY_TO_RECIPIENT. ToString( );

strPartiesXml + ="";

strPartiesXml + ="";

strPartiesXml + ="";

strPartiesXml + ="" + mailFrom +"";

if ( fromObjectType = = Microsoft. Crm. Software. Forms. ObjectType. otSystemUser )

strPartiesXml + ="" + Microsoft. Crm. Program. Forms. ObjectType. otSystemUser. ToString( ) +"";

}

else if ( fromObjectType = = Microsoft. Crm. Program. Forms. ObjectType. otAccount )

strPartiesXml + ="" + Microsoft. Crm. System. Forms. ObjectType. otAccount. ToString( ) +"";

}

else if ( fromObjectType = = Microsoft. Crm. System. Forms. ObjectType. otContact )

strPartiesXml + ="" + Microsoft. Crm. System. Forms. ObjectType. otContact. ToString( ) +"";

}

else if ( fromObjectType = = Microsoft. Crm. System. Forms. ObjectType. otLead )

strPartiesXml + ="" + Microsoft. Crm. Software. Forms. ObjectType. otLead. ToString( ) +"";

}

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

strPartiesXml + ="";

strPartiesXml + = Microsoft. Crm. Software. Forms. ACTIVITY_PARTY_TYPE. ACTIVITY_PARTY_SENDER. ToString( );

strPartiesXml + ="";

strPartiesXml + ="";

strPartiesXml + ="";

log.Debug(strPartiesXml);

// Create the e-mail image

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

returning emailId;

}

find ( System. Web. Services. Techniques. Exception electronic )

logs. Debug( "ErrorMessage:" + electronic. Information +"" + e. Detail. OuterXml+" Origin:" + e. Cause );

}

catch ( Excuse e )

logs. Debug(e. Concept+" \r

" + electronic. StackTrace );

}

return new Guid( );

}

5. You must set up the activity's colors in accordance with MS CRM standards to make the newly created exercise display properly:

public void UpdateActivityCodes( Guid emailId )

try

OleDbCommand control = con. CreateCommand( );

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

command.Prepare();

control. Guidelines. Add( new OleDbParameter (" DirectionCode", Microsoft. Crm. System. Forms. EVENT_DIRECTION. ED_INCOMING) );

control. Guidelines. Add( new OleDbParameter (" StateCode", Microsoft. Crm. Software. Forms. ACTIVITY_STATE. ACTS_CLOSED) );

demand. Criteria. Add( new OleDbParameter (" PriorityCode", Microsoft. Crm. System. Forms. PRIORITY_CODE. PC_MEDIUM) );

demand. Guidelines. Add( new OleDbParameter ("ActivityId", emailId ) );

register. Debug(" Prepare to update exercise password" + emailId. ToString (" B" )+" in ActivityBase" );

command.ExecuteNonQuery();

}

catch( Exception e )

logs. Debug(e. Concept+" \r

" + electronic. StackTrace );

}

}

public void UpdateActivity QueueCodes( Guid emailId, Guid queueId )

try

OleDbCommand control = con. CreateCommand( );

demand. SET Priority = ( )" SET CommandText = "UPDATE QueueItemBase SET Priority = ( )" ), State = (? ), QueueId = (? ) WHERE ObjectId = (? )";

command.Prepare();

demand. Criteria. Add( new OleDbParameter (" Priority", Microsoft. Crm. System. Forms. PRIORITY_CODE. PC_MEDIUM) );

order. Criteria. Add( new OleDbParameter (" State", Microsoft. Crm. Software. Forms. ACTIVITY_STATE. ACTS_CLOSED) );

control. Criteria. Add( new OleDbParameter (" QueueId", queueId ) );

order. Criteria. Add( new OleDbParameter ( "ObjectId", emailId ) );

register. Debug(" Prepare to update task queue password" + emailId. ToString (" B" )+" in QueueItemBase" );

command.ExecuteNonQuery();

}

catch( Exception e )

logs. Debug(e. Concept+" \r

" + electronic. StackTrace );

}

}

Happy customizing, implementing and modifying! If you want us to do the work- give us a call 1-866-528-0577! support @albaspectrum. web

댓글목록

등록된 댓글이 없습니다.