Всем доброго дня!
Не могу понять почему не выполняется SendEmailRequest.
Подскажите, плиз, куда копать?
CRM 4.0 RU8
X++:
namespace CRM_SendMailActivity
{
[CrmWorkflowActivity("Send Mail")]
public partial class SendMailActivity : SequenceActivity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
IWorkflowContext workflowContext = contextService.Context;
ICrmService crmservice = workflowContext.CreateCrmService(true);
Guid EmailId = new Guid(EntityIDIN);
QueryByAttribute queryByAttribute = new QueryByAttribute();
queryByAttribute.ColumnSet = new AllColumns();
queryByAttribute.EntityName = EntityName.email.ToString();
queryByAttribute.Attributes = new string[]{"activityid"};
queryByAttribute.Values = new string[] { EmailId.ToString() };
BusinessEntityCollection retrieved = crmservice.RetrieveMultiple(queryByAttribute);
if (retrieved.BusinessEntities.Count == 0)
return ActivityExecutionStatus.Canceling;
SendEmailRequest sendrequest = new SendEmailRequest();
sendrequest.EmailId = ((Key)((email)retrieved.BusinessEntities[0]).activityid).Value;
sendrequest.TrackingToken = "";
sendrequest.IssueSend = true;
crmservice.Execute(sendrequest);
return ActivityExecutionStatus.Closed;
}
public static readonly DependencyProperty EntityIDINProperty =
DependencyProperty.Register("EntityIDIN", typeof(string), typeof(SendMailActivity));
[CrmInput("Entity ID InpuT")]
public string EntityIDIN
{
get { return (string)GetValue(EntityIDINProperty); }
set { SetValue(EntityIDINProperty, value); }
}
}
}