从 Microsoft Dynamics CRM 中的自定义实体中删除重复项

发布于 2024-09-12 11:51:22 字数 632 浏览 4 评论 0原文

有没有人找到合并或删除自定义实体中的重复项的好方法?在我们的例子中,我们有两个自定义实体:文学历史和订阅,它们将联系人与名为文学的自定义实体相关联。

我可以运行重复检测作业,但这会返回数千条记录,并且一次删除一条记录充其量是不切实际的。我们希望能够合并它们或仅删除重复项。然而,除了“你可以写点东西”之外,谷歌搜索并没有找到任何好的建议。

好吧,但是从哪里开始呢?我应该从重复检测作业中批量删除吗?我应该尝试使用 SDK 编写一个快速而肮脏的 C# 程序吗?有没有一种方法可以合并自定义实体,只需要一些神奇的工作流程巫毒?

编辑:仅供参考,我最终所做的是使用一些有趣的 SQL 设置删除状态代码以快速查找重复项:

UPDATE T1 SET DeletionStateCode = 2 
FROM New_subscriptionhistory T1 INNER JOIN New_subscriptionhistory T2 ON t1.New_LiteratureId = T2.New_LiteratureId AND t1.New_ContactId = t2.New_ContactId
AND t1.CreatedOn > t2.CreatedOn AND t1.statecode = 0 AND t2.statecode = 0

Has anyone found a good way to either merge or remove duplicates that are in custom entities? In our case we have two custom entities, literature history and subscriptions which relate contacts back to a custom entity named literature.

I can run a duplicate detection job, but this returns thousands of records and deleting them one at a time is impractical at best. We would like to either be able to merge them or just delete the duplicates. However, much Google searching has not turned up any good suggestions other than "you can write something."

Okay, but where to even get started? Should I be bulk deleting from the duplicate detection job? Should I try just writing a quick and dirty c# program with the SDK? Is there a way to merge custom entities that just requires some magical workflow voodoo?

EDIT: FYI What I eventually did was setting the deletion state code using some fun SQL to quickly find duplicates:

UPDATE T1 SET DeletionStateCode = 2 
FROM New_subscriptionhistory T1 INNER JOIN New_subscriptionhistory T2 ON t1.New_LiteratureId = T2.New_LiteratureId AND t1.New_ContactId = t2.New_ContactId
AND t1.CreatedOn > t2.CreatedOn AND t1.statecode = 0 AND t2.statecode = 0

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

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

发布评论

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

评论(2

柒七 2024-09-19 11:51:22

您应该考虑使用 SDK 创建批量删除作业。

这是一个简短的教程。

You should look into creating a Bulk Delete Job using the SDK.

Here's a short tutorial.

多像笑话 2024-09-19 11:51:22

我不会肯定地说这是唯一或最好的方法,但我们在 _MSCRM 数据库中使用了 SQL 查询,将任何重复实体的 DeletionStateCode 设置为 2。

I won't say with certainty that this is the only or the best way, but we've used SQL queries in the _MSCRM database, setting the DeletionStateCode of any duplicated entity to 2.

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