我可以使用 ActivityPointer 实体在不同的活动类型上设置相同的状态吗?客户关系管理 2011

发布于 2024-12-21 07:50:31 字数 1186 浏览 7 评论 0原文

我需要确保将 CRM 2011 中与案例(事件)实体相关的所有活动的状态设置为已完成,然后才能将案例本身的状态设置为已解决。

我可以执行多次检索来独立获取所有可能的活动类型,然后对每种类型执行适当的 SetStateRequest(...) 。 这篇文章似乎建议每次任何活动时都会创建一个 ActivityPointer 记录类型记录已创建,并且两条记录具有相同的 ID。果然,当我查看案例和活动时,每个活动类型记录都有一个具有相同 ID 的关联 ActivityPointer 记录。到目前为止,一切都很好。

这是否意味着我可以对与我的案例相关的所有 ActivityPointer 记录进行一次检索并设置它们的状态以实现跨类型活动状态设置?我想我不明白 ActivityPointer 的目的是什么,如果它不允许我进行通用活动操作。这是重点吗?另外,ActivityPointer 实体没有 SetStateRequest 消息,因此有人可以解释我如何在 ActivityPointer 记录上设置状态代码/状态吗?理想情况下,我想要一个已完成的状态和一个已取消的状态。

更新:这个博客似乎准确地展示了我想要的内容,尽管SetStateRequest 的官方文档似乎表明它不支持 ActivityPointer 实体。我明天会尝试这个,但如果有人对最佳的继续方式有建议,我将不胜感激。

Update2:进一步阅读后,我认为情况是 ActivityPointer 实体只能设置​​其状态。因此,我应该能够根据此设置将所有活动指针记录设置为取消状态。我认为我不能一般地设置“状态原因”是有道理的,因为它在活动类型之间有所不同。我对前面的链接仍然有点困惑,因为它似乎建议我可以设置活动指针的状态状态,但不清楚这是否是是的,允许什么值组合以及它们的含义......

I need to make sure the state of all activities related to a case (incident) entity in CRM 2011 are set to completed before I can set the state of the case itself to resolved.

I can do several retrieves to get all the possible activity types independently and then do an appropriate SetStateRequest(...) on each type. This article seems to suggest that an ActivityPointer record is created every time any activity type record is created and that both records have the same ID. Sure enough, when I look at cases and activities, every activity type record has an associated ActivityPointer record with the same ID. So far so good.

Does this mean that I can do a single retrieve of all ActivityPointer records that relate to my case and set the state on them to achieve a cross-type activity state setting? I suppose I'm not understanding what the purpose of ActivityPointer is if it doesn't allow me to do generic activity manipulations. Is that the point if it? Also, the ActivityPointer entity doesn't have a SetStateRequest message so can someone explain how I go about setting statecode/status on an ActivityPointer record? Ideally I want a state of completed and a status of cancelled.

Update: This blog seems to show exactly what I want although the offical docs on SetStateRequest seem to indicate that it doesn't support the ActivityPointer entity. I'll try this tomorrow but if anyone has advice on the best way to proceed I'd be obliged.

Update2: On further reading, I think the situation is that an ActivityPointer entity can only have it's state set. So I should be able to set all the activitypointer records to a state of cancelled per this setup. I suppose it makes sense that I cannot generically set the "Status Reason" as it differs between activity types. I'm still a bit confused about the previous link in that it seems to suggest that I can set the State and the Status of an activitypointer but it's not clear if this is true, what values combos are allowed and what they mean...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞清仓 2024-12-28 07:50:31

我可以解释活动指针的最好方法是,它是电子邮件和电话等派生类的基类。

活动指针封装了任何活动的基本属性,因此如果您创建自定义活动,它也将从活动指针扩展。

由此看来,活动指针包含所有活动的状态和状态值,但也不能从 SetStateRequest 访问它。

我想象活动的实际状态(打开、关闭、计划、取消)适用于所有活动,但状态对于每个活动来说都是单独的。

例如。任务可以是开放的,但其状态原因也可以是开放的
虽然电子邮件也可以打开,但其状态原因是“等待发送”

由于这种差异,SetStateRequest 可能不会让您在 ActivityPointer 上运行它,但它可以在每个单独的活动实体上运行。

就执行您计划执行的操作而言,支持的方法是单独检索所有关联的活动,然后执行设置的状态请求。

您可以像您想要的那样一次性完成所有操作,但会涉及一些“不受支持”,因为您可能必须直接在数据库上执行此操作。但是,当将状态设置为“完成”时,状态原因还必须反映属于该状态的状态。否则我相信活动会出错。

因此,不幸的是,我无法以一种优雅的方式解决它,但如果您找到了,请更新!

The best way I can explain Activity Pointer is that it is the base class to derived classes like Email and Phone Call.

Activity Pointer encapsulates the base attributes of any activity so if you create a custom activity it too will extend from Activity Pointer.

From this it makes sense that Activity Pointer contains the State and Status values of all activities but also makes sense that it cannot be accessed from the SetStateRequest.

I imagine the actual State of the activity, Open, Closed, Scheduled, Cancelled, is applicable to all activities, but the Status is individual to each activity.

Eg. a task can be open but its status reason could also be open
Whereas an email can also be open but its status reason is "Waiting to be Sent"

Due to this differentiation the SetStateRequest probably won't let you run it on ActivityPointer but it would on each individual activity entity.

In terms of doing what you have set out to do, the supported way would be to retrieve all the associated activites individually and then perform a set state request.

You can do it all at once like you want to but would involve a bit of "un-supportedness" in that you would probably have to do it on the database directly. However when setting the state to Complete the status reason would also have to reflect a status that belongs to that state. Otherwise I believe the activities would error.

So unfortunately I can't see a way around it in an elegant way but please do update if you find one!

沩ん囻菔务 2024-12-28 07:50:31

克里斯.我在这里回答我自己的问题,因为有一种方法可以使用活动指针记录来一般关闭所有活动类型。这或许也是有这样记录的原因之一。它依赖于这样一个事实:活动指针记录有一个定义它所代表的活动类型的字段。这是代码:

// do a search for all activities that have a status of open or scheduled
// that covers them all
// here's the filter expression to use
/*
FilterExpression filterStateCode = new FilterExpression();
            filterStateCode.FilterOperator = LogicalOperator.Or;
            filterStateCode.AddCondition("statecode", ConditionOperator.Equal, "Open");
            filterStateCode.AddCondition("statecode", ConditionOperator.Equal, "Scheduled");
*/
// the search returns a list of entities called AllOpenRelatedActivities

foreach (var currentActivityPointer in AllOpenRelatedActivities.Entities)
            {
                if (currentActivityPointer.Attributes.Contains("activityid") & currentActivityPointer.Attributes.Contains("activitytypecode"))
                {
                    currentActivityPointer.LogicalName = currentActivityPointer.Attributes["activitytypecode"].ToString();
                    currentActivityPointer.Id = (Guid)currentActivityPointer.Attributes["activityid"];

                    SetStateRequest setState = new SetStateRequest();
                    setState.EntityMoniker = currentActivityPointer.ToEntityReference();
                    setState.State = new OptionSetValue();
                    setState.State.Value = 2;
                    setState.Status = new OptionSetValue();
                    setState.Status.Value = -1;



                    SetStateResponse setStateResponse = (SetStateResponse)service.Execute(setState);


                }
            }

Chris. I'm answering my own question here because there is a way to use the activity pointer record to generically close all activity types. It may be one of the reasons why there is such a record. It relies on the fact that an activity pointer record has a field that defines what kind of activity it represents. Here's the code:

// do a search for all activities that have a status of open or scheduled
// that covers them all
// here's the filter expression to use
/*
FilterExpression filterStateCode = new FilterExpression();
            filterStateCode.FilterOperator = LogicalOperator.Or;
            filterStateCode.AddCondition("statecode", ConditionOperator.Equal, "Open");
            filterStateCode.AddCondition("statecode", ConditionOperator.Equal, "Scheduled");
*/
// the search returns a list of entities called AllOpenRelatedActivities

foreach (var currentActivityPointer in AllOpenRelatedActivities.Entities)
            {
                if (currentActivityPointer.Attributes.Contains("activityid") & currentActivityPointer.Attributes.Contains("activitytypecode"))
                {
                    currentActivityPointer.LogicalName = currentActivityPointer.Attributes["activitytypecode"].ToString();
                    currentActivityPointer.Id = (Guid)currentActivityPointer.Attributes["activityid"];

                    SetStateRequest setState = new SetStateRequest();
                    setState.EntityMoniker = currentActivityPointer.ToEntityReference();
                    setState.State = new OptionSetValue();
                    setState.State.Value = 2;
                    setState.Status = new OptionSetValue();
                    setState.Status.Value = -1;



                    SetStateResponse setStateResponse = (SetStateResponse)service.Execute(setState);


                }
            }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文