locked
Error while trying to avoid duplicates when creating records using global 'Action'. RRS feed

  • Question

  • I am using the below code to create an Account using global action and trying to avoid duplicate records: but I am getting an error message "Unrecognized request parameter: SuppressDuplicateDetection"

    Please assist.

                var inputParms = new ParameterCollection();
                inputParms.Add(new KeyValuePair<string, object>("firstname", "John"));
                inputParms.Add(new KeyValuePair<string, object>("lastname", "oliver"));
    
                CreateRequest reqCreate = new CreateRequest();
                reqCreate.RequestName = "dev_CreateCustomer";
                reqCreate.Parameters = inputParms;
                reqCreate.Parameters["SuppressDuplicateDetection"] = false;
                CreateResponse createResponse = (CreateResponse)_service.Execute(reqCreate);


    Thanks and Regards.



    Tuesday, May 9, 2017 7:04 AM

All replies

  • The CreateRequest is used for a Create message, but you're trying to change the RequestName. To call an action, you should use a generic OrganizationRequest, not a CreateRequest

    If you have an action called dev_CreateCustomer, then code within the action will need to set the SuppressDuplicateDetection parameter in a CreateRequest. You could control this by adding an input parameter called SuppressDuplicateDetection to the dev_CreateCustomer action, but based on the error you haven't done this


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Tuesday, May 9, 2017 11:17 AM
    Moderator
  • Try using this "MSCRM.SuppressDuplicateDetection" instead of just "SuppressDuplicateDetection"
    Wednesday, May 24, 2017 10:56 PM