![]() ![]() If you still can’t make the index created (after clicking the Reactive Key), you can delete and re-create the Keys again.Įven with the above code and commenting createRequest = false code, System will still throw the error: Created from the code will still throw an error SummaryĪlternate keys can be used if you want to have a strict way to ensure data correctness (same like SQL Indexes). Once you deleted the duplicate data, you can click on the failed Keys > More Actions > Reactive Key in order to make the index again. ![]() But if the system detects there is duplicate data in the table, the creation will be failed and you need to delete data first: Error when creating alternate key You just need to select the columns that you want to define the uniqueness of the record > click Save and the System will automatically create the indexes for you. To make the alternate key, you just need to go to your table definition > Keys > click the New button and the below dialog will be displayed: Create alternate key Hence this method will be more strict compared Duplicate Detection Rules. This method is the same as creating unique-index(es) from the database perspective. The next alternative is to make alternate keys to define the uniqueness of the table. If you trigger the above code and you input the same value, you will get the below error: Error Duplicate Detection Rule from code Alternate Keys Var response = (CreateResponse)client.Execute(createRequest) To Trigger Duplicate Detection Rules, you need to pass 'SuppressDuplicateDetection' parameterĬreateRequest = false Var client = new CrmServiceClient(connectionString) Var connectionString = WebConfigurationManager.AppSettings ![]() This is a sample of what it will look like if we save duplicate data from UI: UI Duplicate Detection Ruleįrom the code perspective, you can set the system to throw an error if it detects duplicate data using the below code:ĬrmServiceClient.MaxConnectionTimeout = TimeSpan.FromHours(3) *you also have an option to exclude those records with the state inactive For sample, I show the existing rule from the Contact table (if you create by yourself, don’t forget to Publish it): Duplicate Detection Rules dialog The last part is to create the Duplicate Detection Rule from Settings > Data Management > Duplicate Detection Rules. Then for the individual table, you need to ensure that Duplicate Detection is checked: Check Duplicate detection in table level
0 Comments
Leave a Reply. |