【问题标题】:Microsoft CRM Dynamics Online - How to retrieve a list of Campaigns and add a contact to itMicrosoft CRM Dynamics Online - 如何检索营销活动列表并向其中添加联系人
【发布时间】:2015-03-31 13:21:51
【问题描述】:

首先,我对 Microsoft Dynamics CRM Online 比较陌生。

我的目标:我想从我们的 CRM 中获取当前活动的活动列表(在我的例子中是事件列表),并将它们列在预订表单的下拉列表中。然后,我希望一个人填写表格并选择他们想参加的活动。点击提交后,将在 CRM 中创建一个联系人,并将此人添加到“回复”部分作为参加者。

到目前为止我所拥有的:

public void Run(String connectionString, String AddDetails)
    {
        try
        {
            // Establish a connection to the organization web service using CrmConnection.
            Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(connectionString);

            // Obtain an organization service proxy.
            // The using statement assures that the service proxy will be properly disposed.
            using (_orgService = new OrganizationService(connection))
            {
                // Instantiate an account object.
                Entity account = new Entity("contact");

                // Set the required attributes. For account, only the name is required. 
                // See the metadata to determine 
                // which attributes must be set for each entity.
                account["lastname"] = AddDetails;

                _orgService.Create(account);
            }
        }

                    // Catch any service fault exceptions that Microsoft Dynamics CRM throws.
        catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
        {
            // You can handle an exception here or pass it back to the calling method.
            throw;
        }
    }

我可以创建联系人并检索此记录的唯一 ID。这完美地工作。我只想检索一个活动并将其附加到接下来的活动/活动中。

我的问题:我似乎无法获取广告系列列表以将它们添加到网页,然后将此人附加到广告系列。

我已经阅读了很多关于创建令人困惑的快速广告系列的文章。我想要达到的目标是否超出常规?还是不可能?谁能提供一些代码让我朝着正确的方向开始?

提前致谢

【问题讨论】:

  • 我认为你能做的最好的就是阅读扩展章节,你在谈论很多东西,但它们必须一一来,一是客户端代码(Javascripts,WebResources) ,另一件事是插件,工作流,通过rest或soap调用IOrganizationService。有很多方法可以做你需要做的事情,但我认为你需要知道你要做什么以及为什么要这样做。
  • 非常感谢您的建议。我想这可能是我发布这个问题后得到的答案。有我想完成的特定任务。但是,我会离开并阅读有关相关主题领域的更多信息。

标签: c# crm microsoft-dynamics dynamics-crm-online


【解决方案1】:

首先您需要检索广告系列

QueryExpression qe = new QueryExpression("campaign");
qe.ColumnSet = new ColumnSet(true); // this will retrieve all fields, you should only retrieve attribute you need ;)

EntityCollection collection = _orgService.RetrieveMultiple(qe);

然后你可以遍历这个集合来获取你需要的列表。

然后在您的用户提交自定义表单(webresource 或其他应用程序)后,您需要在 CRM 中创建活动响应

var campaignResponse = new Entity("campaignresponse");
campaignResponse["regardingobjectid"] = new EntityReference("campaign", YOUR CAMPAIGN GUID);
campaignResponse["customer"] = new EntityReference("lead/account/contact", RECORDGUID);
_orgService.Create(campaignResponse);

这应该让你走上正轨;)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-12
    • 2016-04-03
    • 2019-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多