Answered by:
CRM 3.0 - Create email activity

Question
-
Hi all,
I´m trying to create and email activity on a Post update callout of an Account and send it.
When a custom field "Financial Status" is updated, i need to send an email for the customer to inform that they have invoices to bill.
I get an example on the sdk of how to send an email, I tested and I can send email, I start by sending existing email because I thought it would be more difficult that creating an email activity. But at this moment I can´t create email activity by callout.
Here´s my code:public Guid SetEmail(Guid accountid, string fromEmail) { try { Logger.LogMessage("Método SetEmail"); email newEmail = new email(); // Specify who the email is FROM activityparty from = new activityparty(); from.partyid = new Lookup(); from.partyid.Value = new Guid(fromEmail); from.partyid.type = EntityName.systemuser.ToString(); // Specify who the email is TO activityparty to = new activityparty(); to.partyid = new Lookup(); to.partyid.Value = accountid; to.partyid.type = EntityName.account.ToString(); // Add the TO and FROM parties to the email newEmail.from = new activityparty[] {from}; newEmail.to = new activityparty[] {to}; //Direction specifies if the email is Outgoing ( true ) or Incoming (false ). //CrmBoolean direction = new CrmBoolean(); //direction.Value = true; //newEmail.directioncode = direction; newEmail.subject = "Trying"; newEmail.description = "This email was create by callout"; newEmail.regardingobjectid = new Lookup(); newEmail.regardingobjectid.type = EntityName.account.ToString(); newEmail.regardingobjectid.Value = idConta; Guid emailID = crmSrv.Create(newEmail); return emailID; } catch(Exception ex) { Logger.LogMessage(ex.ToString()); throw; } }
I got an error on the Create message that is:
System.Web.Services.Protocols.SoapException: Server was unable to process request.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Devscope.CRM.Vortal.Callouts.WSMSCRM3.CrmService.Create(BusinessEntity entity)
at Devscope.CRM.Vortal.Callouts.Utils.ActivitiesFinancialStatus.SetEmail(Guid idConta, String fromEmail)
Does anyone can tell me what I doing wrong?
And just one more question, I want to create the email but I want the description uses a template that I create before. So the user can change the message at anytime.
JessicaFriday, May 8, 2009 10:54 AM
Answers
-
Hi, Jessica.
Try to set CallerId for the crmSrv.
Look articles for explanation:
http://msdn.microsoft.com/en-us/library/aa682071.aspx
http://msdn.microsoft.com/en-us/library/aa683920.aspx
Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com- Proposed as answer by Andrii ButenkoMVP, Moderator Friday, May 8, 2009 11:43 AM
- Marked as answer by Jessica Ferreira Friday, May 8, 2009 11:43 AM
Friday, May 8, 2009 11:04 AMModerator
All replies
-
Hi, Jessica.
Try to set CallerId for the crmSrv.
Look articles for explanation:
http://msdn.microsoft.com/en-us/library/aa682071.aspx
http://msdn.microsoft.com/en-us/library/aa683920.aspx
Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com- Proposed as answer by Andrii ButenkoMVP, Moderator Friday, May 8, 2009 11:43 AM
- Marked as answer by Jessica Ferreira Friday, May 8, 2009 11:43 AM
Friday, May 8, 2009 11:04 AMModerator -
Thanks,
I don´t realise that I forgot to put that important part of the code.
That problem is now solved.
So my next step is to know how to create and email activity base on an email template.
Can help me with that?- Edited by Jessica Ferreira Friday, May 8, 2009 11:32 AM error writing
Friday, May 8, 2009 11:20 AM -
Hi, Jessica.
I don't know way how to use such templates for email sending.
Execpt you can use string template for your email body and concatenate it with records' fields retrieved through service.
Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.comFriday, May 8, 2009 11:47 AMModerator