如何在Dynamics CRM VOC中获取调查实体与响应路由之间的关系?

时间:2018-01-17 11:27:58

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

我正在开发一个收集"问题"的软件。来自使用this technique 导航调查的Dynamics CRM。

到目前为止,我看到的任何属性都无法用于在问题和我得到的responserouting集合之间创建链接。

是否可以将响应路由连接到它侦听的问题? 那么它是否也可以将它连接到它管理的问题?

到目前为止,我找不到任何连接属性,我可以用它来识别问题和/或响应路由。

此功能收集问题

    private static DataCollection<Entity> GetQuestions(Guid _surveyId)
    {
        // Find survey question responses
        QueryExpression questionQuery = new QueryExpression
        {
            EntityName = "msdyn_question",
            ColumnSet = new ColumnSet(true),
            Criteria = new FilterExpression
            {
                Conditions =
                {
                    new ConditionExpression
                    {
                        AttributeName = "msdyn_surveyid",
                        Operator = ConditionOperator.Equal,
                        Values = {_surveyId}
                    }
                }
            }
        };
        return connection.service.RetrieveMultiple(questionQuery).Entities;
    }

此函数返回ResponseRouting对象:

    private static DataCollection<Entity> GetRouting(Guid _surveyId, string query)
    {
        // Find survey question responses
        QueryExpression questionQuery = new QueryExpression
        {
            EntityName = query,
            ColumnSet = new ColumnSet(true),
            Criteria = new FilterExpression
            {
                Conditions =
                {
                    new ConditionExpression
                    {
                        AttributeName = "msdyn_survey",
                        Operator = ConditionOperator.Equal,
                        Values = {_surveyId}
                    }
                }
            }
        };
        return connection.service.RetrieveMultiple(questionQuery).Entities;
    }

我确实得到了相应的ResponseRouting对象,但是我找不到任何参考点,我可以在哪里以及如何格式化早期的问题。

这完全基于c#代码,我需要能够通过代码访问它,否则它没有帮助...

1 个答案:

答案 0 :(得分:1)

调查问题和响应路由之间没有直接关系。但是在响应路由记录中,当您添加Condition时,您必须选择Question。

所以需要的链接是在响应路由的条件记录和问题

  

响应路由规则有3个部分:
  常规标签(包含名称   规则和调查名称)
  条件标签(包含   调查要满足的条件)
  操作(包含操作   在满足条件时采取的措施)

enter image description here

Read more

<强>更新

响应条件与问题,响应路由&amp;的关系得到N:1。调查。

由于您已经有问题列表,因此请仔细阅读每个问题&amp;使用以下方法,您可以获得相关的响应路由。

private static DataCollection<Entity> GetRoutingConditions(Guid _questionId, Guid _surveyId)
{
    // Find Routing conditions
    QueryExpression routingConditionQuery = new QueryExpression
    {
        EntityName = "msdyn_responsecondition",
        ColumnSet = new ColumnSet(true),
        Criteria = new FilterExpression
        {
            Conditions =
            {
                new ConditionExpression
                {
                    AttributeName = "msdyn_questionid",
                    Operator = ConditionOperator.Equal,
                    Values = {_questionId}
                }
            }
        },
        LinkEntities =
        {
            new LinkEntity
            {
                LinkFromEntityName = "msdyn_responsecondition",
                LinkToEntityName = "msdyn_responserouting",
                LinkFromAttributeName = "msdyn_responseroutingid",
                LinkToAttributeName = "msdyn_responseroutingid",
                LinkCriteria =
                {
                    Filters =
                    {
                        new FilterExpression
                        {
                            FilterOperator = LogicalOperator.And,
                            Conditions =
                            {
                                new ConditionExpression("msdyn_surveyid", ConditionOperator.Equal, _surveyId)
                            }
                        }
                    }
                }
            }
        }
    };
    return connection.service.RetrieveMultiple(routingConditionQuery).Entities;
}