Add custom field to KB View of workspace

djdevarahos
Tera Contributor

We have a custom field created in kb_knowledge and need to have it displayed in KB view of workspace. I have already added the field in KB view of Legacy by modifying KB Content UI Macro. 

For Workspace KB Knowledge SNC Page Variant is read-only and I have created a duplicate page. Data is derived from Data source "get_article_details_1".   If anyone has acheived something similar, help is appreciated

3 REPLIES 3

Matthew_13
Mega Sage

Hi Buddy,

Yes, this can be done in Workspace, but it works very differently than the old KB Content UI Macro approach.

In Workspace, the KB article page is driven entirely by UI Builder + data resources. Even though you duplicated the SNC page variant (which is the right move), the page will only ever show what the data source returns. Adding the field to the page alone isn’t enough.

The most common thing that’s missing is that the data source (get_article_details_1) simply doesn’t include your custom field.

Here’s the practical way to approach it:

First, double-check ACLs. Workspace strictly enforces ACLs. Even if it works for you as admin, the field won’t show if the user viewing the article doesn’t have read access to that custom field on kb_knowledge.

Second, duplicate the data source. You can’t safely modify the OOTB get_article_details_1, so create your own version. In UI Builder, duplicate that data resource (or recreate it if it’s backed by a script include / data broker).

In the server-side logic of that data resource, explicitly add your custom field to the response. For example, if it’s querying kb_knowledge, make sure it pulls u_your_field and includes it in the JSON payload returned to the page.

Third, update your duplicated page to use your custom data source instead of the OOTB one. This step is easy to miss — if the page is still pointing at the original data source, your field will never appear no matter what components you add.

Fourth, add a component to display the field. Most OOTB Knowledge components won’t automatically render custom fields. Add a simple text, key-value, or label/value component and bind it to your data source output (for example, data.article.u_your_field).

Finally, make sure your custom page variant is actually being used. Workspace routing will still use the SNC page unless your custom page/variant is mapped correctly or has higher priority. This is another very common gotcha.

In short:
Legacy KB = UI Macro controls rendering
Workspace KB = data source controls what’s available

Once the field is returned by the data source and bound to a component on your custom page, it will display just fine.

 

@djdevarahos - Please mark Accepted Solution and Thumbs Up if you found helpful

djdevarahos
Tera Contributor

@Matthew_13  Thanks for the response. As I mentioned,  I understand that Data source "get_article_details_1" is to be changed. I am not an expert in UI builder and can you guide

1. How can I duplicate the data source "get_article_details_1"

2. How to update the data source JSON? I am not sure how this is rendered into form/view 

{
  "articleDetails": {
    "articleHTML": "",
    "articleInfo": {
      "author": "",
      "baseVersion": "",
      "displayAttachments": false,
      "isExpired": false,
      "kbCategory": "",
      "kbKnowledgeBase": "",
      "number": "",
      "officeDocUrl": "",
      "rating": 0,
      "revisedBy": "",
      "shortDescription": "",
      "sysClassName": "",
      "sysId": "",
      "sysUpdatedOn": "",
      "sysViewCount": 0,
      "workflowState": ""

Hi Buddy

In Workspace, the KB page only shows what the data resource returns. Adding a field to the page alone won’t work.

To duplicate get_article_details_1:

  • Open your KB page in UI Builder

  • Go to Data (left panel)

  • Find get_article_details_1

  • Use Duplicate if available, or Open record → Insert and Stay

  • Rename it (for example get_article_details_custom)

  • Back in UI Builder, remove the original data source and add your new one

To add your custom field to the JSON:

  • Open your duplicated data resource

  • Find where it builds articleDetails.articleInfo

  • Add a line like:

    articleInfo.u_my_field = gr.getValue('u_my_field');
  • Save

To display it:

  • Add a simple Text / Label-Value component

  • Bind it to:

    Data → get_article_details_custom → articleDetails → articleInfo → u_my_field

Also double-check ACLs and make sure your custom page is the one actually being used.

That’s all that’s needed.

@djdevarahos - Please mark Accepted Solution and Thumbs Up if you found helpful