我的目标是按ID找到Lead,并添加到此主要活动历史记录(SendedEmail类型)
我有带有潜在客户ID和html正文(电子邮件)的列表我需要将此电子邮件添加到Lead的活动历史记录中,因为它是从saleforce发送的。
如何构建活动历史记录(SendedEmail类型)元素,并将其添加到我的主角
//This what i am tried
SF.QueryResult _ExistingLead = m_SalesForceReference.query("Select Lead_ID__c FROM Lead where Email='xxx.xx@com'");
if (_ExistingLead.records.Count() != 0)
{
//going throw all my leads
foreach (SF.Lead item in _ExistingLead.records)
{
SF.ActivityHistory Activitymail = new SF.ActivityHistory();
Activitymail.Id = item.Lead_ID__c;//here i added lead id to my ActivityHistory
Activitymail.Mobile__c = "123456";
SF.SaveResult[] _SaveResults = m_SalesForceReference.create(new SF.sObject[] { Activitymail });
//not working
//No errors but i cant see it in the lead
}
}
我在这里缺少什么?
如何构建活动历史记录(SendedEmail类型)元素,并将其添加到我的主角?
答案 0 :(得分:0)
我计算如何添加活动历史(似乎是只读元素)
但是我通过从我的主管发送电子邮件并将其添加到活动历史记录来实现这一目标
这里是代码
SF.Lead MyLead = (SF.Lead)_ExistingLead.records[0];
string OwnerId = MyLead.OwnerId;
string Contact_ID__c = MyLead.Lead_ID__c;
SF.SingleEmailMessage mail = new SF.SingleEmailMessage();
String[] toAddresses = new String[] { "vovaLead@dd.com" };
mail.toAddresses = (toAddresses);
mail.bccSender = (true);
String[] bccAddresses = new String[] { "vovaLeadBcc@dd2.com" };
mail.bccAddresses = (bccAddresses);
mail.targetObjectId = (Contact_ID__c);
mail.saveAsActivity = (true);//THIS WILL ADD THIS EMAIL TO ACTIVITY HISTORY
mail.subject = ("some text");
mail.plainTextBody ="some text";
SF.SendEmailResult[] _SaveResults = m_SalesForce.sendEmail(new SF.Email[] { mail });
重要的是要确保:
导航至设置>电子邮件管理>可更新的可交付性 所有电子邮件的访问级别。