Announcements
Hello,
I am trying to create Knowledge Article record and getting below error:
{"error":{"code":"0x80040237","message":"A record with matching key values already exists.",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionSourceKey":
"Plugin/Microsoft.Crm.Service.ObjectModel.KnowledgeArticleService",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiStepKey":"2c33e9b7-ac2e-4dcc-8e73-a8cbc0eab812",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiDepthKey":"1",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiActivityIdKey":"5405f633-dc70-4be4-b17e-722a0c777e66",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiPluginSolutionNameKey":"System",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiStepSolutionNameKey":"System",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionCategory":"ClientError",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionMessageName":"DuplicateRecord",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionHttpStatusCode":"412",
"@Microsoft.PowerApps.CDS.ErrorDetails.SqlExceptionMessage":"Violation of UNIQUE KEY constraint 'ndx_KnowledgeArticleBase'.
Cannot insert duplicate key in object 'dbo.KnowledgeArticleBase'. The duplicate key value is <redacted>.",
"@Microsoft.PowerApps.CDS.HelpLink":"go.microsoft.com/.../
Microsoft.Crm.CrmException%3a80040237&client=platform",
"@Microsoft.PowerApps.CDS.InnerError.Message":"Cannot insert duplicate key."}}
Has anyone faced this before?
Thanks,
Mridula
Can you check the duplicate detection rules. Because when you create anything manually and if it is a duplicate then you can ignore the warning manually but when you try same thing with code/customization, then probablu system will not allow this creation.
calling createKnowledgeArticles function with same title and content again and again.
While doing so, its throwing error. But not sure which is the field considered as duplicate by KA.
P.S. I have 50+ KA's with same title and content. So considering this, thinking title and content cannot be unique fields.
Are you trying to create multiple KA's and running the code again to create same ones?
--> No, How do you create multiple KA ?
Hi Mehdi,
I tried commenting st_products custom field. Still facing same issue.
Hi Mehdi,
Are you trying to create multiple KA's and running the code again to create same ones?
Thanks,
Mridula
I can't reproduce this issue on my environment. Could you test the same code without the "st_products" attribute ?
No.
Do you have any alternate keys for the entity Knowledge Article?
hi Mehdi,
var data =
{
"st_products": sessionStorage.getItem("ProductValue"),
"title": sessionStorage.getItem("Title"),
"content": content
}
// create account record
Xrm.WebApi.createRecord("knowledgearticle", data).then(
function success(result) {
},
function (error) {
}
);
st_products is a custom multi select optionset value.
The above error which I am getting is random, if I run the same set of records again and again, it creates KA's and sometimes(randomly) throw error.
I have 50+ KA's with same title and content.
Thanks,
Mridula
Hi,
Please share your code ..
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156