本文へ移動
cccskills
無料GitHub で公開

knowledge-classic-to-lightning

Migrating Classic Knowledge (KnowledgeArticleVersion / Article Types) to Lightning Knowledge (Knowledge__kav with record types): article-type-to-record-type mapping, multi-language translation preservation, data category re-architecture, file attachment porting, version and publication-state retention, channel visibility translation, and downstream Case Feed / Community / Bot rewiring. NOT for new Lightning Knowledge setup or editorial publishing workflow design (use admin/knowledge-base-administration).

インストール方法を見る

含まれるファイル(7)

  • SKILL.md22.5 KB
  • references/examples.md8.3 KB
  • references/gotchas.md8.1 KB
  • references/llm-anti-patterns.md6.5 KB
  • references/well-architected.md7.5 KB
  • scripts/check_knowledge_classic_to_lightning.py4.1 KB
  • templates/knowledge-classic-to-lightning-template.md3.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Knowledge Classic to Lightning Migration

This skill activates when a practitioner needs to migrate from Classic Knowledge (multiple Article Types as separate sObjects) to Lightning Knowledge (a single Knowledge__kav sObject with record types), preserving versions, translations, data categories, and downstream consumer integrations.


Before Starting

Gather this context before working on anything in this domain:

  • Confirm Classic Knowledge is enabled and inventory Article Types: SELECT Id, MasterLabel, DeveloperName FROM KnowledgeArticleType. Each Classic Article Type is a separate sObject (FAQ__kav, HowTo__kav, etc.); Lightning collapses them into one Knowledge__kav with record types.
  • Inventory translations. SELECT Language, COUNT(Id) FROM KnowledgeArticleVersion WHERE PublishStatus='Online' GROUP BY Language. Lightning Knowledge supports the same multi-language structure but the migration must port each language version individually.
  • Inventory data categories. SELECT Id, MasterLabel, ParentId FROM CategoryGroup and SELECT Id, MasterLabel, GroupId FROM Category. Categories carry over but visibility settings must be re-validated against the new record-type structure.
  • Identify downstream consumers: Case Feed Knowledge Component (Lightning Service Console), Knowledge Sidebar (Classic only — being deprecated), Community Knowledge pages, Einstein Bot Knowledge action, Salesforce Service Cloud "suggested articles" on Cases, and any Apex code querying article sObjects directly.
  • Confirm whether the Salesforce-provided Lightning Knowledge Migration Tool is in scope. The Migration Tool handles 80–90% of cases; custom code is needed only for unusual data category structures, custom field mappings, or article-type consolidation decisions.

Core Concepts

1. Object Model: From Many to One

Classic Knowledge created one sObject per Article Type — FAQ__kav, HowTo__kav, Procedure__kav, etc. Each had its own fields, layouts, and validation rules.

Lightning Knowledge has ONE sObject: Knowledge__kav. Differentiation between former Article Types is via record types on Knowledge__kav.

Classic ConceptLightning EquivalentMigration Action
Article Type (FAQ__kav, HowTo__kav)Record Type on Knowledge__kavCreate one record type per Article Type
Per-Article-Type custom fieldsFields on Knowledge__kav (with field-level page-layout assignment per record type)Create unified field set; assign visibility per record type
Per-Article-Type page layoutsPage layouts assigned per record typeRecreate layouts; assign
Per-Article-Type validation rulesValidation rules on Knowledge__kav (with RecordType.DeveloperName predicate)Translate predicates
KnowledgeArticleVersion (single base sObject)Knowledge__kav (Knowledge Article Version) — yes, same suffixSame conceptual structure; field semantics preserved
Article Type approval processesApproval processes on Knowledge__kav (with record-type entry criteria)Recreate per record type

2. Migration Tool vs Custom Migration

PathWhen to useTradeoffs
Salesforce Lightning Knowledge Migration ToolStandard Article Types, standard data categories, modest custom fieldsOfficially supported; handles versions, translations, publication state
Custom migration (Apex / Bulk API)Unusual schemas (custom approval workflows, non-standard field mappings, partial migration scope)Full control; significant effort; must replicate the Migration Tool's handling of versions and translations
Hybrid (Tool + post-processing)Standard articles via Tool; targeted custom logic for edge casesBest of both; requires sequencing discipline

The Salesforce Migration Tool is invoked from Setup → Knowledge → Lightning Knowledge Migration Tool. It runs in the background, produces a detailed log, and supports re-run for failed articles. Default to using it.

3. Versions and Publication States

Classic Knowledge tracks versions: each article has a "master" version, may have an "online" published version, and may have draft versions. Translations are per-version per-language.

Publication StateWhat it means
DraftAuthor is working on a new or updated version
Online (Published)Visible to channels
ArchivedPreviously published, now archived

Lightning Knowledge preserves the same state machine. Migration must port the publication state per-language per-version. The Migration Tool handles this; custom migrations must explicitly preserve PublishStatus, IsLatestVersion, and IsVisibleIn* flags.

4. Translations

Each translated article in Classic is a KnowledgeArticleVersion row with the same KnowledgeArticleId (the master article) and a different Language value. Lightning Knowledge structure is identical: each translation is a Knowledge__kav row sharing a KnowledgeArticleId with a different Language.

FieldPurpose
Knowledge__kav.KnowledgeArticleIdStable across versions and translations
Knowledge__kav.LanguageThe translated locale
Knowledge__kav.IsMasterLanguageTrue for the master version's language record
Knowledge__kav.TranslationCompletedDateTracks when each translation was finished

Migration MUST preserve the KnowledgeArticleId linkage so master and translations stay grouped. Inserting translations as standalone articles (with new KnowledgeArticleId per language) breaks the language-switcher UX in the published surface.

5. Data Categories: Preserved but Re-validated

Data Category Groups, Categories, and the category visibility settings (per role / permission set) port directly. The migration tool preserves the assignments. The risk is that record-type-based visibility (new in Lightning) may unintentionally restrict article visibility for users who previously saw articles by category alone.

Verify: pre-migration, run "as user X, list visible articles." Post-migration, run the same query. Visible-article counts should match (or differences should be intentional and documented).

6. Downstream Consumer Migration Surface

ConsumerClassicLightningMigration step
Case Feed Knowledge sidebarKnowledge Sidebar in Service ConsoleKnowledge Component in Lightning Service ConsoleAdd Knowledge Component to Lightning record page; remove Classic sidebar config
Community Knowledge tabCommunity page using Classic article type sObjectCommunity page using Knowledge__kavUpdate Community Builder pages; field references may need updating
Einstein Bot "Suggest Articles"Bot dialog action with Classic article typeBot action with Knowledge__kavUpdate bot action; test "suggested articles" intent flow
Service Cloud "Suggested Articles" on CaseAuto-suggest using Classic articlesAuto-suggest using Knowledge__kavRe-enable in Knowledge Settings; verify article matching
Apex querying FAQ__kav directlyHardcoded sObject referenceKnowledge__kav WHERE RecordType.DeveloperName = 'FAQ'Code change; deploy with the rest of the migration

Common Patterns

Pattern 1: Standard Migration via Lightning Knowledge Migration Tool

When to use: Org has standard Article Types, modest custom field counts, and uses the standard Knowledge object model.

How it works:

  1. Take a sandbox copy. NEVER run the migration tool directly in production without sandbox validation.
  2. In sandbox, enable Lightning Knowledge from Setup → Knowledge Settings.
  3. Run the Lightning Knowledge Migration Tool from Setup → Knowledge → Lightning Knowledge Migration Tool.
  4. Map each Article Type to a record type. Map each Classic field to its Lightning counterpart.
  5. Submit; the tool runs asynchronously. Monitor via the Migration Tool log page.
  6. After completion, validate: counts match, translations present, data categories preserved, publication states correct.
  7. Test downstream consumers in sandbox.
  8. Repeat in production once sandbox is signed off. The Migration Tool runs in production exactly the same way.

Why not the alternative: The Migration Tool handles version history, translation linkage, publication state, and data categories better than custom code in 90% of cases. Build custom only when the Tool cannot handle a specific concern.

Pattern 2: Custom Field-Mapping Decisions Requiring Pre-Processing

When to use: Some Classic fields need to be renamed, merged, or transformed before migration. Example: two Article Types both have a "Summary" field, but one is Description__c and the other is Summary__c — they should map to the same Lightning field.

How it works:

  1. In the Classic source, normalize field names BEFORE running the Migration Tool. Add a unified Article_Summary__c field to every relevant Article Type, populate it via Apex script from the legacy fields.
  2. Run the Migration Tool with the unified field mapping to a single Lightning field.
  3. Drop the legacy fields after verification.

Why not the alternative: The Migration Tool maps fields 1:1 — it cannot merge two source fields into one target. Pre-processing in Classic is the right place for the transform.

Pattern 3: Article Type Consolidation Decisions

When to use: The org has too many Article Types (8+). Some are legacy / barely used. Lightning Knowledge benefits from fewer record types — easier list views, simpler approval workflows, simpler reporting.

How it works:

  1. Pre-migration, audit Article Types by published-article count and last-update date.
  2. Decide which Article Types collapse: e.g., merge "FAQ" and "Q_and_A" into one Lightning record type called "FAQ".
  3. Use the Migration Tool's record-type mapping to point both Article Types at the single Lightning record type.
  4. Document field-mapping conflicts (where the merged Article Types had different fields with similar purposes).

Why not the alternative: Migrating 1:1 preserves the current proliferation indefinitely. Migration is the moment to rationalize the taxonomy — afterward, consolidating record types requires more downstream rewiring (record-type-aware code, layouts, validation rules).

Pattern 4: Phased Channel Cutover

When to use: The org publishes articles to multiple channels (Internal, Communities, Public) and cannot risk a simultaneous cutover everywhere.

How it works:

  1. Migrate to Lightning Knowledge in sandbox + production with all channels disabled in Lightning.
  2. Cut over Internal users first: enable Internal channel for Lightning, disable Internal channel for Classic. Service agents use Lightning Knowledge.
  3. After 2 weeks of stable Internal use, cut over Communities. Update Community Builder pages, retest.
  4. Public Knowledge Base last. The public-facing surface is the highest-risk; cut last after all internal validation.

Why not the alternative: A single big-bang channel cutover risks customer-facing issues with no rollback time. Channel-by-channel preserves rollback at each step.


Decision Guidance

SituationRecommended ApproachReason
Standard Article Types, standard fields, modest scaleSalesforce Lightning Knowledge Migration ToolHandles versions, translations, categories with low risk
Need to merge two source fields into one targetPre-process in Classic via Apex; THEN run Migration ToolTool maps 1:1 only
Need to consolidate Article Types (8 → 4)Use Migration Tool record-type mapping for consolidationSaves a follow-up rationalization project
Multilingual with active translationsMigration Tool handles natively; verify per-language countsPreserves translation linkage via KnowledgeArticleId
Heavy data category visibility customizationTest category-based visibility post-migration with role-impersonationRecord types add new visibility axis that may unintentionally restrict
Many channels (Internal, Customer, Partner, Public)Phased channel cutover (Pattern 4)Maintains rollback options
Apex code references FAQ__kav directlyUpdate to Knowledge__kav WHERE RecordType.DeveloperName = 'FAQ'; deploy with migrationRequired for the integration to find articles post-migration
Einstein Bot uses Knowledge actionUpdate bot action AFTER migration; test "suggested articles" flowBot action references the Knowledge object; must point at Knowledge__kav
Org is on Classic UI primarilyMigration may require Service Cloud Console UI modernization in parallelLightning Knowledge needs Lightning Service Console for the Knowledge Component

Recommended Workflow

Step-by-step instructions for an AI agent or practitioner working on this task:

  1. Sandbox-first inventory and decision matrix. Spin up a Full Copy or Partial sandbox (production enablement is irreversible without article deletion). Enumerate Article Types, custom fields, data categories, languages, channels, downstream consumers. For each Article Type, decide: keep as own record type, consolidate with another, or drop.
  2. Pre-process if consolidating fields or types. Run Apex scripts in Classic to normalize fields BEFORE invoking the Migration Tool. Add unified fields, populate, and validate.
  3. Run the Migration Tool in sandbox. Configure mappings carefully — this is the high-cognitive-load step. Submit, monitor via the Migration Tool log.
  4. Validate exhaustively. Counts per Article Type → record type. Counts per language. Publication state distribution. Data category visibility (impersonate users via System.runAs). Sample articles open and render correctly.
  5. Update downstream consumers in sandbox. Service Console pages, Communities, Einstein Bots, Apex code. Test end-to-end (Case Feed shows articles; Community search returns expected results).
  6. Sign off; replicate in production with phased channel cutover. Run the Migration Tool with identical configuration in production. Cut over channels Internal → Communities → Public Knowledge Base with stability windows between each — never simultaneously.
  7. Post-cutover audit and decommission. After a 30-day soak, run a last-known-good comparison (article count per category, per language, per channel matches the pre-migration baseline). Then decide retain (read-only audit) or drop the Classic Article Types — dropping is irreversible, so be deliberate.

Review Checklist

Run through these before marking work in this area complete:

  • Migration Tool ran successfully in sandbox; log shows zero unrecoverable errors
  • Article counts per former Article Type → record type match exactly (allow only documented exclusions)
  • Translation counts per language match pre-migration baseline
  • Data category assignments match: same articles in same categories
  • Publication state distribution matches: Online / Draft / Archived counts agree
  • User-perspective visibility tested for at least one user per relevant role / permission set
  • Service Console Knowledge Component is added to Case page layout and surfaces articles
  • Community Builder pages reference Knowledge__kav (not legacy article type sObject)
  • Einstein Bot Knowledge actions updated and tested in conversation
  • Apex code referencing FAQ__kav, HowTo__kav, etc. updated to Knowledge__kav with record-type filter; tests pass
  • Phased cutover schedule agreed; channel-by-channel rollback plan documented
  • Migration audit log persisted (Classic article ID → Lightning Knowledge__kav ID, per language, per version)

Salesforce-Specific Gotchas

Non-obvious platform behaviors that cause real production problems:

  1. Enabling Lightning Knowledge is irreversible without deleting articles. Once you enable Lightning Knowledge in Setup, you cannot revert to Classic Knowledge without disabling Knowledge entirely — which deletes ALL articles. This is why sandbox-first is mandatory. Test the full migration in sandbox before touching production.

  2. Knowledge__kav is one sObject, but article-type record types still drive layouts and validation. The "we have one object now" mental model leads admins to assume layouts are global. They aren't — page layouts are still assigned per record type, validation rules use RecordType.DeveloperName predicates, and approval processes have record-type entry criteria. Migration must recreate per-record-type layouts and rules.

  3. Translations preserve KnowledgeArticleId — break this and the language switcher disappears. The Migration Tool does this correctly. Custom migrations that insert translations as fresh records (each with its own KnowledgeArticleId) lose the master-translation linkage. The published article surface has a "view in another language" switcher that depends on this linkage; without it, users see translations as completely separate articles.

  4. Data category visibility is per-role and per-permission-set; consolidation may unintentionally restrict. A Classic article visible to a role via category visibility may, post-migration, also be subject to record-type access controls. Users who lacked the new record type's read access lose visibility even though categories are unchanged. Audit visibility per user role post-migration.

  5. The Service Console Knowledge Component requires Lightning Service Console — not Lightning Experience alone. Some orgs run on Lightning Experience for sales but Service Console for support. The Knowledge Component renders only inside Service Console. If your support team is using non-console Lightning pages, Knowledge surfacing will be broken until Service Console is adopted.

  6. Salesforce Knowledge "channels" (Internal, Customer, Partner, Public) are visibility flags, not separate stores. A single article record can be visible in multiple channels via IsVisibleInPkb, IsVisibleInCsp, IsVisibleInPrm, IsVisibleInApp. Migration must preserve every flag per article. The Migration Tool does this; manual or partial migrations that miss a flag silently hide articles from the channel.

  7. PublishStatus is queryable but not directly settable via DML — use KbManagement.PublishingService Apex methods. Custom migration code that tries to INSERT Knowledge__kav (PublishStatus='Online') fails. Lightning Knowledge requires using KbManagement.PublishingService.publishArticle(articleId, isFlagAsNew) to publish, editOnlineArticle(articleId, false) to create a draft from an online version, etc. The Migration Tool handles this; manual scripts must use the Apex publishing service.

  8. Quick Actions on Cases referenced article-type sObjects directly in some setups. A "Insert Article" Quick Action that hardcoded FAQ__kav in its URL or relationship breaks after migration. Audit Case Quick Actions for __kav substring references and update to Knowledge__kav.


Output Artifacts

ArtifactDescription
Lightning Knowledge enabled in target orgSetup change; preserved across deployments
Knowledge__kav record typesOne per former Article Type (or per consolidated group)
Page layouts and validation rulesRecreated per record type
Migrated articlesVersions, translations, publication state, and data categories preserved
Migration audit logClassic article ID → Lightning Knowledge__kav ID, per language and per version
Updated Service Console pagesKnowledge Component added; Classic sidebar config removed
Updated Community Builder pagesReferences switched to Knowledge__kav
Updated Einstein Bot dialogsKnowledge actions point at Lightning structure
Updated Apex code__kav references switched and deployed
Phased cutover planChannel-by-channel with stability windows

Related Skills

  • admin/knowledge-base-administration — Use for new Lightning Knowledge configuration (post-migration)
  • admin/approval-processes — Use when designing approval workflows on the migrated articles
  • agentforce/rag-patterns-in-salesforce — Use when migrated articles will ground Einstein/Agentforce responses
  • lwc/visualforce-to-lwc-migration — Use if Knowledge surfaces also include Visualforce pages being modernized
  • data/data-cloud-data-streams — Use when migrated articles must also populate Data Cloud for AI grounding

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use this skill when writing test-first, behavior-driven acceptance criteria in Given/When/Then format for a Salesforce user story. Covers happy path, edge cases, negative paths, permission boundaries, and data-state preconditions so the AC block can drive UAT scripts and Apex test design downstream. Trigger keywords: given when then, gherkin, behavior driven AC, test first acceptance criteria, scenario outline, BDD acceptance criteria. NOT for the user-story format itself (use admin/user-story-writing-for-salesforce). NOT for UAT script writing (use admin/uat-test-case-design). NOT for Apex test method generation (use agents/test-class-generator). NOT for high-level UAT planning (use admin/uat-and-acceptance-criteria). More triggers: acceptance criteria record, ac_id, req_id on a criterion, artefact under test, negative case for a rule-type requirement, no-match fall-through criterion, oracle for a Then clause, test type apex flow manual, criteria linter, check_ac_format.py, --manifest-dir.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Task and Event objects: polymorphic WhatId/WhoId, Activity object model, ActivityHistory vs OpenActivity, activity timeline customization, bulk task creation, Einstein Activity Capture boundaries. NOT for turning on EAC or calendar sync — use admin/einstein-activity-capture-setup. NOT for Email-to-Case — use admin/case-management-setup. Covers ActivitiesSettings metadata, enableActivities, shared Task/Event custom fields and FLS, TaskStatus value sets, Shared Activities and TaskRelation/EventRelation, recurring and child activities, and partial-success bulk DML on Task.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Design Invocable Apex actions that return deterministic, agent-friendly errors instead of surfacing raw exceptions to the LLM. NOT for authoring the action itself — @InvocableMethod schema, labels, security context — use agentforce/custom-agent-actions-apex. NOT for the Apex tests that force each error branch — use agentforce/agent-action-unit-tests.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Use when designing how an Agentforce agent extracts structured input parameters (slots) from a user's natural-language utterance to invoke an action. Triggers: 'agent extract date from user', 'agent action argument extraction', 'agentforce slot filling', 'agent invocable input mapping', 'agent fails to fill required parameter'. NOT for action authoring (use agentforce/agent-actions) or for prompt-template variable binding (use agentforce/prompt-builder-templates).

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Apex test patterns for @InvocableMethod agent actions: per-reason-code branch coverage, bulk safety, callout mocking, deterministic assertions. NOT for testing whether the agent routes to the right topic or answers well — use agentforce/agent-testing-and-evaluation. NOT for designing the error envelope the tests assert on — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Designing or reviewing Agentforce actions: Flow actions, Apex invocable actions, prompt-template actions, action naming, input and output contracts, confirmation requirements, and safe error behavior. Triggers: 'agent actions', 'build an agent that can look up an order', 'make the agent able to check order status', 'give the agent a capability', 'agent that can retrieve a record', 'flow action for agent', 'agent invocable action', 'action schema design'. NOT for writing the Apex class itself — use agentforce/custom-agent-actions-apex. NOT for the reason_code error envelope that stops an agent retry loop — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

PranavNagrecha のスキルをすべて見る

このスキルの問題を報告する