Has anybody run into the below issue when setting topics to a knowledge article from external system? I am using Rest to integrate. I receive the error..

ERROR: Error:Insert failed. First exception on row 1; first error: DUPLICATE_VALUE, A topic with the name, pro forma, already exists.: [Name] has been sent via Direct Message

I have an existing topic in salesforce org by name 'proforma' but not 'pro forma'. SO my code which is developed to create or update topics based on their existence in SF should work properly. I even tried inserting 'pro forma' from workbench and it successfully inserts the topic without throwing a duplicate error. It is soo weird that it throws this error only from the REST api call and not from workbench.

This has been driving me nuts for a while now. Any inputs will be greatly appreciated!!! :)

1 Answer 1


I found the Knowledge Article #231339 - Topic names are case and space insensitive.

When inserting the following code in Developer console, then the error message is displayed as shown.

insert new topic(name = 'TEST 4 - 5');
insert new topic(name = 'TEST 4-5');

Error: Line: 2, Column: 1
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, A topic with the name, TEST 4-5, already exists.: [Name]

Resolution: The reason for error is due to the fact that topic names are case and space insensitive

That content came from the Google Cache, for some reason it isn't showing up directly at the moment.

Oddly, the Topic API documentation says:

You can change only the spacing and capitalization of a topic name with the update property.

There is definitely some sensitivity to whitespace.

  • Thanks! To avoid the space sensitive error i am replacing the whitespace with a hyphen to the incoming topic name and insert it as a seperate topic. Now the other issue i have is - if there is a topic by name 'pro forma' already in salesforce and I try to send a topic with name 'proforma' from external system, it still throws the duplicate value error. How do i fix such issues as I cannot query for the existing topic with the incoming topic name 'pro forma' as it returns zero records. And there is no way for me to find the topic name thats existing in the system.
    – shilpa
    Feb 10, 2016 at 16:23
  • You could try making code that will find similar records. E.g. Select Like 'pro%'. Then scan the results for records that would be duplicates if the white space was removed. The viability of this approach would depend on how many Topic records you have. Feb 10, 2016 at 18:46
  • i tried that earlier but i see a bunch of results. Any more ideas?
    – shilpa
    Feb 10, 2016 at 21:13
  • Opened a case with salesforce and they came back with the usual working as designed answer.!!
    – shilpa
    Feb 25, 2016 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .