将活动链接到CRM 4.0中的帐户

时间:2009-03-12 14:24:46

标签: dynamics-crm dynamics-crm-4

我正在使用CRM 4.0 Web服务界面开发应用程序,需要以编程方式创建电话记录并将其链接到帐户记录。我可以看到如何创建记录,但我不知道如何将电话号码链接到该帐户。任何帮助将不胜感激。

由于

1 个答案:

答案 0 :(得分:5)

您无法直接将活动(如电话)链接到实体(如帐户)。您必须使用activityparty对象来执行此操作 为此,请按照以下步骤操作(我假设该帐户存在):

        phonecall newPhoneCall = new phonecall ();

        // Set the properties of the newPhoneCall.
        newPhoneCall.subject = "Test newPhoneCall";
        newPhoneCall.description = "New newPhoneCall";

        // Create the party sending and receiving the newPhoneCall.
        activityparty party = new activityparty();

        // Set the properties of Activityparty.
        party.partyid = new Lookup();
        party.partyid.type = EntityName.account.ToString();
        party.partyid.Value = existingAccount.accountId;

        // The party sends and receives the newPhoneCall.
        newPhoneCall.from = new activityparty[] { };
        newPhoneCall.to = new activityparty[] { party };

然后正常创建电话呼叫活动。