function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jo_DengJo_Deng 

How to create a custom button to allow users to create articles?

Right now our users go through Case -> Close Case -> Save and Create Article to submit new articles.  I'd like to create a custom button or link to allow users to submit articles from a different page.  What is the code that is required for this?

etienne.giraudyetienne.giraudy

jo9ix,

if you want to add a button on the case detail page for creating an article, the code is pretty simple.

  1. add a new custom button which conten t source is a URL.
  2. the URL is: /knowledge/publishing/articleEditSimple.apexp?sourceId={!Case.Id}&retURL=/{!Case.Id}

Let me know if this works for you!

Etienne

etienne.giraudyetienne.giraudy

jo9ix,

please also note that this customization, based on URL parameters, is not officially supported and may break in the future

Thanks

Etienne

Jo_DengJo_Deng

Hi Etienne,

 

Thank you for the fast response!

 

I would like to have the button added to the sidebar or the homepage, so a user doesn't have to submit an article that is related to a case.  The idea is we want our users to contribute to a knowledge base that is not always as a result of a case.  Is that something you would not recommend?  If I want to do that but not reference a case, do I just take out the case reference?

 

/knowledge/publishing/articleEditSimple.apexp?

etienne.giraudyetienne.giraudy

jo9ix,

Unfortunatelly no, this will not work without a case reference.

This means you have 2 choices:

  1. using a dummy case that you keep in your system just for this purpose, "hardcoding" the ID in the URL, or
  2. you need to re-create an equivalent VF page, backed by an Apex classes which will uses Knowledge API to insert the new article. 

Etienne