如何通过 Web API 将电子邮件添加为商机中的活动
本文关键字:商机 活动 添加 电子邮件 何通过 Web API | 更新日期: 2023-09-27 17:56:16
我试图将电子邮件作为使用 Web API 的活动之一添加到商机中,以下是我尝试的代码:
CR304000Content CR304000 = context.CR304000GetSchema();
context.CR304000Clear();
List<Command> cmds = new List<Command>();
cmds.Add(new Value { Value = opportunity.ID, LinkedCommand = CR304000.OpportunitySummary.OpportunityID, Commit = true });
cmds.Add(new Value { Value = "Draft", LinkedCommand = CR304000.Activities.MailStatus});
cmds.Add(new Value { Value = "Email", LinkedCommand = CR304000.Activities.Type});
cmds.Add(new Value { Value = email.Subject, LinkedCommand = CR304000.Activities.Summary });
cmds.Add(new Value { Value = email.Message, LinkedCommand = CR304000.Activities.NoteText });
cmds.Add(CR304000.Actions.Save);
代码没有给我错误,但是,在我运行代码后,我收到了一个"注释",而不是电子邮件,在该机会下添加到"活动"中。
有人可以给我一些将电子邮件(草稿)作为活动添加到商机中的线索吗?由于我可以手动转到"组织"->"客户管理"->"机会"并单击"活动"选项卡,然后单击"添加电子邮件"按钮将电子邮件(草稿)添加到商机,我假设我应该能够通过 web api 做同样的事情......
感谢您的帮助。
请参阅下面的代码片段,将电子邮件草稿添加到现有商机。
<!-- language: c# -->
//Opportunity Screen
CR304000Content CR304000 = context.CR304000GetSchema();
context.CR304000Clear();
//Email Activity Screen
CR306015Content CR306015 = context.CR306015GetSchema();
context.CR306015Clear();
//Locate Opportunity for which Email Draft needs to be added
CR304000Content[] CR304000result = context.CR304000Submit(
new Command[]
{
new Value { Value = "000007", LinkedCommand = CR304000.OpportunitySummary.OpportunityID, Commit = true},
//Invoke New Email Actity Action
CR304000.Actions.NewMailActivity
});
//Specify data for Email Activity
CR306015Content[] CR306015result = context.CR306015Submit(
new Command[]
{
new Value { Value = "Subject 7", LinkedCommand = CR306015.Message.Subject },
new Value { Value = "Notes Addition 7", LinkedCommand = CR306015.Message_.ActivityDetails},
CR306015.Actions.Save
});