locked
How to Unpublish/Publish a Detection Rules by default in CRM 2011 RRS feed

  • Question

  • Hello all

    I go to Settings -> Data Management -> Duplicate Detection Rules => I can see all duplicate detection rules records.

    Some defined rules is unpublished and somes are publised. How can I change it in customization.

    I want to set Published for 1 and another is unpublished in default when import new organization.

    Do you have any idea for it, please?

    Thanks


    If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

    Monday, September 8, 2014 10:43 AM

Answers

  • you need to use PublishDuplicateRuleRequest and UnpublishDuplicateRuleRequest

    My blog: www.crmanswers.net - Rockstar 365 Profile

    • Marked as answer by AnyMi Tuesday, September 23, 2014 2:53 AM
    Monday, September 22, 2014 10:02 AM
  • Hello

    Thanks for your answer. That is what I need :)

    new UnpublishDuplicateRuleRequest
                            {
                                DuplicateRuleId = rule.Id
                            });


    If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

    • Marked as answer by AnyMi Tuesday, September 23, 2014 2:55 AM
    Tuesday, September 23, 2014 2:55 AM

All replies

  • If you are using CRM 2013 you could use the package Deployer tool with some custom code to activate rules but out of the box Duplicate Detection Rules are considered "data" and not solution aware

    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Monday, September 8, 2014 12:58 PM
    Moderator
  • Hello

    I've try to use "SetStateRequest" to update state of entity DuplicateRule. But I've got this exception:

    SetStateDynamicEntity' method does not support entities of type 'duplicaterule'.

    So is there anyway that I can update state of it by code?

    Thanks


    If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

    Monday, September 22, 2014 9:53 AM
  • you need to use PublishDuplicateRuleRequest and UnpublishDuplicateRuleRequest

    My blog: www.crmanswers.net - Rockstar 365 Profile

    • Marked as answer by AnyMi Tuesday, September 23, 2014 2:53 AM
    Monday, September 22, 2014 10:02 AM
  • Hello

    Thanks for your answer. That is what I need :)

    new UnpublishDuplicateRuleRequest
                            {
                                DuplicateRuleId = rule.Id
                            });


    If my question/answer can help you, please give me a points :) ----You may be disappointed if you fail, but you are doomed if you don't try---

    • Marked as answer by AnyMi Tuesday, September 23, 2014 2:55 AM
    Tuesday, September 23, 2014 2:55 AM