Loading...
Loading...
Use this skill to run the full end-to-end Life Sciences Cloud setup workflow for a key account management (KAM) user in sequence. Trigger when the user says 'set up Life Sciences Cloud end to end for kam user', 'run the full LSC setup for kam user', 'orchestrate Life Sciences Cloud configuration for kam user', 'complete LSC setup for kam user', or 'Life Sciences Cloud full install for kam user'. Executes six stages in order: prerequisites validation, starter config deployment, territory configuration, participant role and sprint creation, KAM data and plan-template (goals, tasks, measures) creation, and KAM user provisioning — gating each stage on the success of the previous one. DO NOT TRIGGER when: the user wants to run only one specific stage individually, or when the request targets a field sales rep rather than a KAM user (use life-sciences-fieldsalesrep-coordinate for that persona).
npx skill4agent add forcedotcom/sf-skills life-sciences-kam-coordinatelife-sciences-fieldsalesrep-coordinatelife-sciences-prerequisites-validatelife-sciences-territory-configureTerminology: Stage = one of the 6 units of work, each delegated to a child skill/reference; Phase = a named group inside a stage; Step = an atomic action inside a phase.
references/orchestration-flow.md| # | Stage | Runs | Gate (must pass to advance) | Output |
|---|---|---|---|---|
| — | Setup: download | — | Folder present (MANDATORY — hard stop) | Shared source folder in CWD |
| 1 | Prerequisites Validation | | All prerequisites PASS | Org confirmed ready |
| 2 | Starter Config Deploy | | 13 deploy steps + KAM config records succeed | LSC Custom Profile + KAM/Sprint settings |
| 3 | Territory Configuration | | Territory model Active + L3 territory | Level-3 territory ID + name |
| 4 | Participant Role & Sprint | | Participant role + sprint created | Role + Sprint IDs |
| 5 | KAM Data & Plan Templates | | Account/HCP/product/territory data created + goals, template (Final), items, assignment created + goals/template/PATI shared to the leaf territory | Account + product master data + published ActionPlanTemplate |
| 6 | KAM User Provisioning | | User created, permsets + territory assigned; metadata cache generated | KAM username |
sf org list --jsonhttps://login.salesforce.comhttps://test.salesforce.comsf org login web --instance-url <url> --alias <alias> --set-defaultsf org list --jsonOrchestrationState.targetOrgIfreturns no authenticated orgs, go straight to the fresh-org login (option N).sf org list
.lsc-starter-config/LSStarterConfig/.lsc-starter-configrm -rf .lsc-starter-config lsstarter-tmp
git clone --no-checkout --depth 1 --filter=blob:none \
https://github.com/SalesforceLabs/LSStarterConfig.git lsstarter-tmp
cd lsstarter-tmp && git sparse-checkout init --cone \
&& git sparse-checkout set Codey/LSStarterConfig && git checkout && cd ..
mv lsstarter-tmp/Codey ./.lsc-starter-config && rm -rf lsstarter-tmphas its own.lsc-starter-config/LSStarterConfig/(pinssfdx-project.json) — deploy steps must run from inside it.sourceApiVersion: 65.0
.lsc-starter-config/LSStarterConfig/sfdx-project.json.lsc-starter-config/LSStarterConfig/Data/ls .lsc-starter-config/LSStarterConfig/sfdx-project.json .lsc-starter-config/LSStarterConfig/DatasourceFolderDownloaded: truesourceFolderDownloaded: falselife-sciences-prerequisites-validatereferences/stage-2-starter-config-overview.mdKAMSettings_OrgLevelSprintSettings_OrgLevelsf data query --query "SELECT Id, Name FROM Profile WHERE Name = 'LSC Custom Profile'" --target-org <org> --jsonlife-sciences-territory-configuresf data query --query "SELECT Id, Name, DeveloperName, Territory2Model.State FROM Territory2 WHERE ParentTerritory2.ParentTerritory2Id != null AND Territory2Model.State = 'Active'" --target-org <org> --jsonOrchestrationState.territoryIdreferences/stage-4-participant-role-and-sprint.mdMasterLabelNameParticipantRoleDeveloperName = 'Rep_Execution_Specialist'IsActive = trueSprintNot Startedreferences/stage-5-data-and-plan-templates-overview.mdLifeSciMarketableProductProductTerritoryAvailabilityLifeSciMarketableProductGoalDefinitionGoalDefinitionProductActionPlanTemplateActionPlanTemplateVersionActionPlanTemplateItemActionPlanTemplateAssignmentGoalDefinitionActionPlanTemplateProviderAcctTerritoryInfoFinalActionPlanTemplateVersionActionPlanTemplateAssignmentGoalDefinitionShareActionPlanTemplateShareProviderAcctTerritoryInfoShareUserOrGroupIdreferences/stage-6-user-provisioning-overview.mdkamIsActive=trueLSC Custom ProfileUserTerritory2AssociationStatus='Active'sf data query --query "SELECT COUNT(Id) c FROM PermissionSetAssignment WHERE AssigneeId = '<newUserId>' AND PermissionSet.IsOwnedByProfile = false" --target-org <org> --json<model><territory>Rep Execution Specialist<name><territory><name><territory><name><username>LSC Custom Profile<territory>rm -rf .lsc-starter-configStatus='Active'references/stage-6-ipad-validation-script.mdOrchestrationState = {
targetOrg: string,
sourceFolderDownloaded: boolean, // downloaded in Phase 1, deleted in Phase 9
territoryId?: string, territoryName?: string, // captured in Stage 3, reused in Stages 5 & 6
stages: [
{ name: "Prerequisites", status: "pending|running|passed|failed|skipped" },
{ name: "StarterConfig", status: "pending|running|passed|failed" },
{ name: "TerritorySetup", status: "pending|running|passed|failed", territoryId?: string, territoryName?: string },
{ name: "ParticipantSprint", status: "pending|running|passed|failed", roleId?: string, sprintId?: string },
{ name: "DataAndPlanTemplates",status: "pending|running|passed|failed", accountId?: string, marketableProductId?: string, templateVersionId?: string },
{ name: "UserProvisioning", status: "pending|running|passed|failed", userId?: string, username?: string }
]
}statusrunningpassedfailedpendingrunningreferences/state-machine-and-changes.md.lsc-starter-config/LSStarterConfigOrchestrationState.territoryIdrunningpassedrunning| Issue | Resolution |
|---|---|
| Source download fails in Phase 1 | Hard stop — do NOT run any stage. Fix the cause or download |
| No connected orgs found | Go straight to the fresh-org login ( |
| Artifacts exist from a prior run | Child skills/references are idempotent/upsert-safe — query to confirm, then skip or re-run |
| Stage re-triggered, or earlier input changed mid-flow | See |
LSC Custom ProfileParticipantRoleSprintProductTerritoryAvailabilityFinalkamreferences/orchestration-flow.md| File | When to read |
|---|---|
| At start — dependency diagram, gate + resume-detection queries, timing |
| On a re-triggered stage or a mid-flow input change |
| Stage 2 — 13-step deploy + KAM/Sprint config records (points to sibling refs) |
| Stage 4 — participant role + sprint |
| Stage 5 — KAM data creation (Part A, points to its data ref) + goals, tasks, measures, action plan template (Part B) |
| Stage 6 — user provisioning + metadata cache (points to sibling refs) |
| Final step — on-device (iPad) validation script shown after the metadata cache is Active |