Wednesday, October 24, 2007

Create CustomerOpportunityRole Record

This is a very simple code, when you wants to create a CustomerOpportunityRole.


try
{

// Create the class
customeropportunityrole oppRole = new customeropportunityrole();

// Define the "Customer" to relate the Opportunity to. // This could be an Account or a Contact//
oppRole.customerid = new Customer();
oppRole.customerid.Value = new Guid("605291D0-C91E-DC11-944B-0003FF0E1518");
oppRole.customerid.type = EntityName.account.ToString();

// Define what Opportunity this relationship is for
oppRole.opportunityid = new Lookup();
oppRole.opportunityid.Value = new Guid("701C12F1-896A-DC11-961B-0003FF0E1518");
oppRole.opportunityid.type = EntityName.opportunity.ToString();

// Define what Relationship Role to use
oppRole.opportunityroleid = new Lookup
oppRole.opportunityroleid.Value = new Guid("D2A640E1-B81A-DC11-A7F0-000C29C33583");
oppRole.opportunityroleid.name="Referral";
oppRole.opportunityroleid.type = EntityName.relationshiprole.ToString();

// Assign StatusCode, StateCode
CrmNumber codeNumber = new CrmNumber();
codeNumber.Value= 1;
oppRole.opportunitystatuscode = codeNumber;

codeNumber.Value= 0;
oppRole.opportunitystatecode = codeNumber;

// Create the relationship
Guid id = service.Create(oppRole);
}
catch(System.Web.Services.Protocols.SoapException ex)
{
MessageBox.Show(ex.Detail.InnerText.ToString() + ex.Message.ToString());
}

Tuesday, October 16, 2007

Enable tracing in Microsoft Dynamics CRM 3.0

Microsoft Dynamics CRM 3.0 lets you create trace files that monitor the actions that are performed by Microsoft CRM. Trace files are helpful when you have to troubleshoot error messages or other issues in Microsoft CRM.You can create unmanaged trace files and managed trace files. The information in the unmanaged trace files and in the managed trace files is determined by required and optional registry entries that you create manually. You create these registry entries on the Microsoft CRM server or on the computer that is running the Microsoft CRM client for Microsoft Office Outlook after you install Microsoft CRM or the Microsoft CRM client for Outlook.


This article published on Microsoft, for more information
visit: http://support.microsoft.com/default.aspx/kb/907490

Happy MS CRM Tracing !!!!!!

Thursday, October 11, 2007

Remove / Detach Email from Queue

DetachFromQueueEmail Message
Detaches the e-mail from the specified queue.

// Use below code.

// Rreplace the WebService URL
service.Url = strWebServiceURL;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

DetachFromQueueEmailRequest objEmail = new DetachFromQueueEmailRequest();

// Assign Email GUID
objEmail.EmailId = new Guid(strEmailGUID.Trim());

// Assign Queue GUID
objEmail.QueueId = new Guid(QueueIdNode.InnerText.Trim().ToString());

service.Execute(objEmail);



Is it so simple..........right.