Surfacing Existing Knowledge Articles in the Guide Library
Series: Build a Salesforce Guide App with AI
Page: 10 of 10
Time to complete: 20–30 minutes
Prerequisites: Page 9 complete. Salesforce Knowledge must be active in your org.
What You’re Doing in This Page
If your org already uses Salesforce Knowledge, you’ve probably got articles that are relevant to the same audience as your Guide Hub guides. This page connects them — Knowledge articles you opt in to will appear in the guide library alongside your custom guides, with a distinct blue badge so users can tell them apart.
The integration is intentionally lightweight. You’re not migrating content, not changing how Knowledge works, and not duplicating anything. You’re adding a single checkbox to the Knowledge object that acts as an opt-in, then updating two things in code to fetch and display those articles.
If Knowledge is not active in your org, skip this page — the rest of the app works without it.
Step 1 — Add the Opt-In Checkbox to Knowledge
- Setup → Object Manager → Knowledge → Fields & Relationships → New
| Setting | Value |
|---|---|
| Data Type | Checkbox |
| Field Label | Show In Guide Hub |
| Field Name | Show_In_Guide_Hub |
| Default Value | Unchecked |
- Click through the next steps and Save
- Add this field to the Knowledge page layout so authors can see and tick it
The checkbox being unchecked by default means existing Knowledge articles are not affected — nothing appears in Guide Hub until an author explicitly opts in per article.
Step 2 — Find Your Knowledge Body Field Name
Before writing any code, you need to know the API name of the field that holds the main content of your Knowledge articles. This varies between orgs — it’s not always Body__c.
Run this in Developer Console → Execute Anonymous:
Map<String, Schema.SObjectField> fieldMap = Knowledge__kav.getSObjectType().getDescribe().fields.getMap();
for (String fieldName : fieldMap.keySet()) {
Schema.DescribeFieldResult f = fieldMap.get(fieldName).getDescribe();
if (f.getType() == Schema.DisplayType.RichTextArea) {
System.debug('Field: ' + fieldName + ' | Label: ' + f.getLabel());
}
}
Check the Logs tab and look for a field with a label like “Answer”, “Body”, or the name of your article type. Note the API name — you’ll need it in the next step.
Step 3 — Add Knowledge Methods to GuideService
💬 Prompt:
Add two methods to GuideService.cls:
getKnowledgeArticles(String searchTerm)— returns Knowledge__kav records where Show_In_Guide_Hub__c = true. No publish status filter — return any status. Searches Title and Summary. Return fields: Id, Title, Summary, ArticleNumber, LastModifiedDate. Mark as cacheable.
getKnowledgeArticleDetail(Id recordId)— returns a single Knowledge__kav where Show_In_Guide_Hub__c = true and Id = recordId. Return fields: Id, Title, Summary, [YOUR_BODY_FIELD_HERE], ArticleNumber, LastModifiedDate, LastModifiedBy.Name. Mark as cacheable. Throw AuraHandledException if not found.Replace [YOUR_BODY_FIELD_HERE] with the actual API name I found: [paste your field name here].
Generate the PowerShell script to write the updated GuideService.cls to force-app/main/default/classes/.
⚠️ The body field name is org-specific. If you use
Body__cand your org usesAnswer__c, the deploy will fail withNo such column 'Body__c' on entity 'Knowledge__kav'. Always check the actual field name in your org before deploying.
Step 4 — Update guideLibrary to Show Knowledge Articles
💬 Prompt:
Update guideLibrary.js to fetch Knowledge articles alongside guides. In the fetchAll() method, use Promise.all to call getGuides() and getKnowledgeArticles() in parallel. Map Knowledge article results to add isKnowledge: true and map Title → Name, Summary → Summary__c so they work with the existing guideCard component. Knowledge articles should only appear under the “All” category — when a specific category filter is active, only show Guide Hub guides.
Generate the updated guideLibrary.js and the PowerShell script to write it.
Step 5 — Opt In Your First Knowledge Article
- Open any Knowledge article in your org
- Edit it and tick Show In Guide Hub
- Save
- Open Guide Hub — the article should appear in the library with a blue Knowledge badge
- Click it — the standalone Guide Article page should open with the article content rendered cleanly
Congratulations — The App Is Complete
You’ve built a fully working internal guide application from scratch, using Claude as your coding assistant throughout. Here’s what you’ve delivered:
- A searchable, filterable guide library
- Rich text guide authoring with video support
- A queue-based approval workflow
- Contextual guides on record pages via sidebar and modal
- A clean standalone reading experience
- An admin-only guide library
- Knowledge article integration
- A full permission model
Every piece of this was built on standard Salesforce platform capabilities — no AppExchange licence, no third-party tools, no ongoing cost beyond the time to maintain the content.
Where to Go From Here
The app as built is production-ready. Some additions worth considering as your usage grows:
- My Guides view — a tab for Guide Admins showing their drafts and pending approvals within Guide Hub, rather than via the standard Guide list view
- Related guides — suggestions in the article sidebar for other guides in the same category
- View count tracking — a simple counter on each article to identify your most-read content
- Mobile optimisation — the components work on desktop; a mobile layout pass would improve the Salesforce app experience
Check Your Work
- ✅ Show In Guide Hub checkbox exists on Knowledge and is on the page layout
- ✅ getKnowledgeArticles and getKnowledgeArticleDetail methods deployed without errors
- ✅ Knowledge articles with the checkbox ticked appear in the library with a blue badge
- ✅ Clicking a Knowledge article opens the standalone page with article content
- ✅ Knowledge articles don’t appear when a category filter is active
← Previous: Page 9 — Permissions and the Security Model
Bonus → Prompting Patterns for Salesforce Development — the meta-skills this series teaches, distilled into reusable patterns for any future Salesforce build with AI.