Skip to main content

Is anyone here aware of a method to preserve html class names in articles when they are created via the API? We are encountering a limitation with the Gainsight article API and I’m curious if anyone has found a workaround. 

We are using the Gainsight community API to create articles in the community knowledge base based on articles that exist in our Salesforce knowledge base. The articles are authored in a separate tool, Madcap Flare, that publishes them to Salesforce as knowledge articles. From Salesforce, we sync the articles to Gainsight CC so that customers can access them.   

There are a subset of articles with complicated layouts that contain class names for styling, applied in the authoring platform by our tech writers. When those articles are sent to Salesforce they retain any class names applied to html elements in the article. 

But when the articles are created in the community knowledge base by the Gainsight API, the class names are removed. This seems to be by design, as we are not able to preserve the class names in Gainsight even when specifically inserting them into the content before publish. 

The only html attribute that we’ve successfully sent over to Gainsight is the id attribute. But that attribute is required to be unique value on any page, so it’s not an ideal replacement for something like a class name, which we need to apply to several elements in the same article, because that’s a non-valid use. Therefore the API will only allow it to be used once with the same value on the page (if it’s asked to add the attribute to a second element, with the same value, it will remove the previous instance first).

The solution we are testing now is to add an incrementor to the id value each time its used on a page, which keeps it unique, in order to apply it to multiple elements. However, this is a bit kludgy and while it technically doesn’t break standards and technically is not an invalid use of the id attribute, it is definitely a workaround.

Is there an official way to preserve or add html attributes when an article is created with the API? 

 

Be the first to reply!

Reply