/lsc:lsc-demo-data-loadingfrom lsc
Guides loading demo data into Life Sciences Cloud (LSC) orgs, covering territory hierarchies, accounts, healthcare providers, contact points, business licenses, and therapy-area scenarios.
Ships in lsc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Always call MCP tools first to check org state before creating data.
| User asks about... | Call this tool |
|---|---|
| Territory setup status | run_soql({ query: "SELECT Id, Name, State FROM Territory2Model LIMIT 5" }) |
| Existing accounts | run_soql({ query: "SELECT COUNT(), IsPersonAccount FROM Account GROUP BY IsPersonAccount" }) |
| Existing HCPs | run_soql({ query: "SELECT COUNT() FROM HealthcareProvider" }) |
| Object fields | describe_sobject({ sobject: "Account" }) or any target object |
| Territory assignments | run_soql({ query: "SELECT COUNT() FROM ObjectTerritory2Association" }) |
| Therapy-area scenarios, demo concepts, related guidance | search_lsc_knowledge({ query: "..." }) (returns cited source content) |
Data must be created in this order due to dependencies:
| Object | Purpose |
|---|---|
Territory2Model | Container for the entire hierarchy (one active model) |
Territory2Type | Types of territories (Geographical, Medical, KAM) |
Territory2 | Individual territory nodes |
GLOBAL (root)
├── US
│ ├── US_NE_Boston
│ ├── US_NE_Washington_DC
│ ├── US_MW_Chicago
│ └── US_W_San_Francisco
├── GB
│ ├── GB_London
│ ├── GB_Manchester
│ └── GB_Edinburgh
├── FR / DE / IT / ES / JP / KR / BR / MX / AR
│ └── (country sub-territories by city)
├── Medical
│ ├── MED_Oncology
│ ├── MED_Cardiology
│ ├── MED_Neurology
│ ├── MED_Immunology
│ └── MED_Primary_Care
└── KAM
├── KAM_Academic_Medical_Centers
├── KAM_Hospital_Systems
└── KAM_Payer_Insurance
State = 'Active' or activate via Setup.Name.DeveloperName to find the parent.| Record Type DeveloperName | Use For |
|---|---|
Health_Care_Organization | Hospitals, clinics, payers, pharmacies |
Health_Care_Provider | Doctors (PersonAccount) |
Account a = new Account();
a.RecordTypeId = hcoRtId;
a.Name = 'Massachusetts General Hospital';
a.Type = 'Hospital';
a.BillingStreet = '55 Fruit Street';
a.BillingCity = 'Boston';
a.BillingStateCode = 'MA';
a.BillingPostalCode = '02114';
a.BillingCountryCode = 'US';
a.Site = 'DEMO-TAG'; // tag for cleanup
Account a = new Account();
a.RecordTypeId = hcpRtId;
a.Salutation = 'Dr.';
a.FirstName = 'Sarah';
a.LastName = 'Chen';
a.PersonEmail = '[email protected]';
a.Phone = '+1 617 726 2000';
a.BillingStreet = '55 Fruit Street';
a.BillingCity = 'Boston';
a.BillingStateCode = 'MA';
a.BillingPostalCode = '02114';
a.BillingCountryCode = 'US';
// CRITICAL: Also set PersonMailing fields for mobile app display
a.PersonMailingStreet = a.BillingStreet;
a.PersonMailingCity = a.BillingCity;
a.PersonMailingStateCode = a.BillingStateCode;
a.PersonMailingPostalCode = a.BillingPostalCode;
a.PersonMailingCountryCode = a.BillingCountryCode;
a.Site = 'DEMO-TAG';
PersonMailing fields required for mobile. The LSC mobile app displays PersonMailingAddress, not BillingAddress, for PersonAccounts. If you only set Billing fields, HCPs show -- under their name on mobile.
Duplicate rules block inserts. Managed package duplicate rules may block account creation. Use Database.DMLOptions with AllowSave = true:
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.DuplicateRuleHeader.AllowSave = true;
Database.insert(accounts, dmlOpts);
State/Country Picklists must be enabled and configured. If a country's state codes aren't configured in the org, setting BillingStateCode will fail. Use empty string '' for countries without configured states:
if (String.isNotBlank(stateCode)) {
a.BillingStateCode = stateCode;
a.PersonMailingStateCode = stateCode;
}
Non-Latin names for JP/KR. Use native script for Japanese and Korean names and addresses:
LastName = '山本', FirstName = '健', street = '本郷7-3-1'LastName = '김', FirstName = '준호', street = '대학로 101'Tag all records for cleanup. Use a consistent tag field (e.g., Site = 'LSCCE-Demo-Data') so you can delete demo data without touching real org data.
CPU time limits. Managed package triggers (lsc4ce) consume significant CPU time. With 220 accounts, expect ~7600/10000ms CPU. Keep batch sizes manageable.
For each doctor, create these in order:
Schema.SObjectType hcpType = Schema.getGlobalDescribe().get('healthcareprovider');
SObject hcp = hcpType.newSObject();
hcp.put('AccountId', doctorAccountId);
hcp.put('Name', 'Dr. Sarah Chen');
hcp.put('SourceSystem', 'DEMO-TAG');
Schema.SObjectType npiType = Schema.getGlobalDescribe().get('healthcareprovidernpi');
SObject npi = npiType.newSObject();
npi.put('HealthcareProviderId', hcpId);
npi.put('Npi', '1234567890'); // 10 digits, unique
npi.put('SourceSystem', 'DEMO-TAG');
ProviderAffiliation links doctors to organizations. This object may not be visible via Schema.getGlobalDescribe() in the same class. Use a separate helper class:
// In a SEPARATE Apex class (e.g., DemoAffiliationHelper)
public class DemoAffiliationHelper {
public static void createAffiliations(List<ProviderAffiliation> affiliations) {
Database.insert(affiliations, false);
}
}
Schema.getGlobalDescribe().get(...)) for Health Cloud objects that may not compile in all orgs.10001xxxxx).ProviderAffiliation object may not be accessible in the same class that references HealthcareProvider. Use a separate helper class.| Object | Purpose | Key Fields |
|---|---|---|
ObjectTerritory2Association | Assigns Account to Territory | ObjectId, Territory2Id, AssociationCause='Territory2Manual' |
ProviderAcctTerritoryInfo (PATI) | Territory-specific account info | AccountId, Territory2Id, IsTargetedAccount, IsAvailableOffline, IsActive |
PrvdAccountTerritorySummary (PATS) | AI/rep summary per account-territory | AccountId, Territory2Id, UserId, KeyInformationSummary |
// 1. Create ObjectTerritory2Association
ObjectTerritory2Association ota = new ObjectTerritory2Association();
ota.ObjectId = accountId;
ota.Territory2Id = territoryId;
ota.AssociationCause = 'Territory2Manual';
// 2. Create ProviderAcctTerritoryInfo
SObject pati = patiType.newSObject();
pati.put('AccountId', accountId);
pati.put('Territory2Id', territoryId);
pati.put('IsTargetedAccount', true);
pati.put('IsAvailableOffline', true);
pati.put('IsActive', true);
pati.put('SourceSystemName', 'DEMO-TAG');
// 3. Create PrvdAccountTerritorySummary
SObject pats = patsType.newSObject();
pats.put('AccountId', accountId);
pats.put('Territory2Id', territoryId);
pats.put('UserId', repUserId); // from UserTerritory2Association
pats.put('KeyInformationSummary', summaryJson);
pats.put('KeyInfoSummaryDateTime', Datetime.now());
pats.put('SourceSystemName', 'DEMO-TAG');
Map accounts to territories by matching BillingCity + BillingCountryCode to territory DeveloperName:
Map<String, String> cityTerrMap = new Map<String, String>();
cityTerrMap.put('US:Boston', 'US_NE_Boston');
cityTerrMap.put('GB:London', 'GB_London');
cityTerrMap.put('FR:Paris', 'FR_Paris');
// ... etc
String key = acct.BillingCountryCode + ':' + acct.BillingCity;
String terrName = cityTerrMap.containsKey(key)
? cityTerrMap.get(key)
: cityTerrMap.get(acct.BillingCountryCode); // country fallback
PATI and PATS records need sharing with territory groups for rep visibility:
// Query territory group IDs
Map<Id, Id> terrToGroupId = new Map<Id, Id>();
for (Territory2 t : [SELECT Id, (SELECT Id, Group.Id FROM Territory2Members LIMIT 1) FROM Territory2 WHERE Id IN :territoryIds]) {
// Territory group Id format: '00G' prefix
}
// Or query Group directly
for (Group g : [SELECT Id, RelatedId FROM Group WHERE Type = 'Territory' AND RelatedId IN :territoryIds]) {
terrToGroupId.put(g.RelatedId, g.Id);
}
// Create share records
ProviderAcctTerritoryInfoShare share = new ProviderAcctTerritoryInfoShare();
// (use dynamic SObject for shares too)
share.put('ParentId', patiRecordId);
share.put('UserOrGroupId', territoryGroupId);
share.put('AccessLevel', 'Edit');
share.put('RowCause', 'Manual');
UserTerritory2Association WHERE Territory2Id IN :terrIds to find which user is assigned to each territory.UserTerritory2Association, not just the country-level territory.ViewAllData and per-object ViewAllViewAll on AccountViewAll = true on Account. This overrides territory-based sharing and lets reps see all accounts.This JSON renders in the LSC mobile app as a structured summary card:
{
"keyInfo": [
{
"sectionName": "Key Activities & Engagement",
"sectionData": [
{"data": "The provider participated in 180 visits over the past year..."},
{"data": "High engagement with Oncolyra, discussed in 120 visits..."},
{"data": "A recent clinical inquiry was submitted regarding..."}
]
},
{
"sectionName": "Discussion Points",
"sectionData": [
{"data": "Discuss the latest Phase III data for Oncolyra..."},
{"data": "Review the provider's patient volume for eligible indications..."}
]
}
],
"changeInfo": [
{
"sectionName": "Affiliation Updates",
"sectionData": [
{"data": "The provider recently established an affiliation with..."}
]
},
{
"sectionName": "Recent Publications & Accreditations",
"sectionData": [
{"data": "Published a recent article on immunotherapy combinations..."}
]
}
]
}
PATS summaries should be in the local language for each country. Use BillingCountryCode to select language:
| Country Code | Language | Example Section Name |
|---|---|---|
| US, GB | English | Key Activities & Engagement |
| FR | French | Activites Cles & Engagement |
| DE | German | Hauptaktivitaten & Engagement |
| IT | Italian | Attivita Chiave & Coinvolgimento |
| ES, MX, AR | Spanish | Actividades Clave & Compromiso |
| JP | Japanese | 主要活動とエンゲージメント |
| KR | Korean | 주요 활동 및 참여 |
| BR | Portuguese | Atividades Principais & Engajamento |
Rotate templates across 4 specialties (Oncology, Cardiology, Neurology, Immunology) using Math.mod(index, 4) to give variety across accounts.
| Object | Records Per Account | Notes |
|---|---|---|
ContactPointAddress | 1 per account (HCO + HCP) | Uses BillingAddress fields |
ContactPointEmail | 2-3 per HCO, 1 per HCP | General + department emails |
ContactPointPhone | 2-4 per HCO, 1 per HCP | Country-formatted numbers |
ContactPointSocial | 1-2 per HCO | LinkedIn and X handles |
Process in batches of 15. The lsc4ce managed package triggers consume ~50 SOQL queries per DML operation on contact points. With a limit of 100 SOQL queries per transaction, batches larger than 15 will hit Too many SOQL queries: 101.
private static final Integer BATCH_SIZE = 15;
// LWC calls createAddressBatch(0), createAddressBatch(15), createAddressBatch(30)...
// Each call processes BATCH_SIZE accounts and returns { created, total, hasMore, errors }
ContactPointAddress cpa = new ContactPointAddress();
cpa.Name = 'DEMO-TAG - Dr. Sarah Chen Primary';
cpa.AddressType = 'Mailing';
cpa.ParentId = accountId;
cpa.Street = acct.BillingStreet;
cpa.City = acct.BillingCity;
cpa.State = acct.BillingState;
cpa.PostalCode = acct.BillingPostalCode;
cpa.Country = acct.BillingCountry;
Rather than creating new users (which requires licenses), repurpose existing users with the "Field Sales Representative" profile:
User u = [SELECT Id, Username FROM User WHERE Profile.Name = 'Field Sales Representative' AND IsActive = true LIMIT 1];
u.Username = '[email protected]';
u.FirstName = 'France';
u.LastName = 'Rep';
u.Alias = 'frrep';
u.Email = '[email protected]';
update u;
// Set password
System.setPassword(u.Id, 'your-password');
// Assign to ALL sub-territories in their country
List<UserTerritory2Association> utas = new List<UserTerritory2Association>();
for (Territory2 t : [SELECT Id FROM Territory2 WHERE DeveloperName LIKE 'FR_%']) {
UserTerritory2Association uta = new UserTerritory2Association();
uta.UserId = userId;
uta.Territory2Id = t.Id;
utas.add(uta);
}
insert utas;
Tag all created records for safe cleanup:
| Object | Tag Field | Tag Value |
|---|---|---|
| Account | Site | DEMO-TAG |
| HealthcareProvider | SourceSystem | DEMO-TAG |
| HealthcareProviderNpi | SourceSystem | DEMO-TAG |
| HealthcareProviderSpecialty | SourceSystem | DEMO-TAG |
| ProviderAffiliation | SourceSystemName | DEMO-TAG |
| ProviderAcctTerritoryInfo | SourceSystemName | DEMO-TAG |
| PrvdAccountTerritorySummary | SourceSystemName | DEMO-TAG |
| CareSpecialty | Description | DEMO-TAG |
| ContactPointAddress | Name (prefix) | DEMO-TAG - ... |
| ContactPointEmail | SourceSystemName | DEMO-TAG |
| ContactPointPhone | SourceSystemName | DEMO-TAG |
| ContactPointSocial | SourceSystemName | DEMO-TAG |
| BusinessLicense | Identifier (prefix) | DEMO-TAG-... |
1. PrvdAccountTerritorySummary (and shares)
2. ProviderAcctTerritoryInfo (and shares)
3. ObjectTerritory2Association
4. ContactPoint* records
5. BusinessLicense
6. ProviderAffiliation
7. HealthcareProviderSpecialty
8. HealthcareProviderNpi
9. HealthcareProvider
10. CareSpecialty (demo-tagged only)
11. Account (cascades delete PersonAccount)
12. Territory2 (bottom-up)
The lsc4ce managed package triggers add significant overhead:
| Operation | Managed Pkg SOQL | Managed Pkg CPU | Safe Batch Size |
|---|---|---|---|
| Account insert | ~3 queries per record | ~35ms per record | 50-100 |
| ContactPoint insert | ~3 queries per record | ~80ms per record | 15 |
| PATI insert | ~2 queries per record | Minimal | 200+ |
| PATS insert | ~1 query per record | Minimal | 200+ |
Database.insert(records, false) for partial success (allOrNothing = false)Database.DMLOptions with AllowSave = true for accounts to bypass duplicate rulesScenarios add specialty-specific data on top of base records:
| Scenario | HCPs | Specialty Accounts | Agentforce Personas |
|---|---|---|---|
| Oncology | Medical/Surgical/Radiation Oncologists | Cancer centers, trial sites | Med Rep, MSL, KAM |
| Cardiology | Cardiologists, Interventional, Surgeons | Heart centers, cath labs | Med Rep, KAM |
| Immunology | Rheumatologists, Dermatologists | Infusion centers, specialty pharmacies | Med Rep, Market Access |
| Neurology | Neurologists, Movement Disorder Specialists | Neuroscience centers | Med Rep, MSL |
| Rare Disease | Geneticists, Metabolic Specialists | Centers of Excellence | MSL, Market Access |
Scenarios are additive — apply multiple for a multi-therapeutic-area demo. Each is independently removable via its own tag.
PersonMailingStreet/City/State/PostalCode/Country on HCP PersonAccounts — the mobile app reads these, not Billing fields.DMLOptions.DuplicateRuleHeader.AllowSave = true.IsPersonAccount = false — HCPs need ContactPointAddress too.Maximum CPU time in debug logs — lsc4ce triggers are expensive.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub salesforcelabs/lsc-for-claude --plugin lsc39 skills in this plugin
/lsc-account-managementGuides Life Sciences Cloud (LSC) Account Management configuration for web and mobile apps. Use when user asks about provider card, addresses, affiliations, ratings, account search, search before create (SBC), data change requests (DCR), business licenses, multi-object component, ARC graph, ContactPointAddress, HealthcareProvider, ProviderAffiliation, Admin Console account settings, or a web HCO picker that returns no organizations./lsc-activity-planGuides Life Sciences Cloud (LSC) Activity Plan configuration for web and mobile apps. Use when user asks about activity plans, account goals, weighted territory goals, shared territory goals, provider activity goals, goal measures, product goals, activity plan review, activity plan batch jobs, time periods, plan cycle, or Admin Console activity plan settings./lsc-agentforceGuides Agentforce for Life Sciences Cloud (LSC) configuration (Winter '26 feature). Use when user asks about Field Sales Agent, agent topics, agent actions, daily briefing, HCP summarization, next best action predictions, visit logging via voice, Einstein Studio integration, or Agentforce customization. For Agentforce Welcome Center utterances/prompts on the mobile home page, use the lsc-home-page-configuration skill instead./lsc-app-alertsGuides Life Sciences Cloud (LSC) App Alerts and Notifications configuration for web and mobile apps. Use when user asks about app alerts, record alerts, notifications, recommendations, guided actions, home office announcements, app alert territory, app alert user response, notification pane, bell icon, or AppAlert objects./lsc-briefingsGuides Briefings (Daily Podcasts) configuration and troubleshooting. Use when user asks about Briefings, Field Insights, Daily Podcasts, audio briefings, Kokoro TTS, PresentationContent, podcast text generation, or on-device audio./lsc-calendar-tot-routineGuides Life Sciences Cloud (LSC) Calendar, Time Off Territory, Routine, and My Team configuration. Use when user asks about calendar settings, Planner Administration, time off territory (TOT), routines, shared calendar, colleague visits, calendar event types, Time Off Territory events, business hours, slot-based TOT, My Team in LSC, or a shared Visit that is on the Activity Timeline and missing from Calendar.Other plugins' skills for the same job