PluginBench
Skill
Pass
Audit score 90

building-omnistudio-flexcard

forcedotcom/sf-skills

How to install building-omnistudio-flexcard

npx skills add https://github.com/forcedotcom/sf-skills --skill building-omnistudio-flexcard
Claude Code
Cursor
Windsurf
Cline
Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


name: building-omnistudio-flexcard description: "OmniStudio FlexCard creation and validation with 130-point scoring. Use when building at-a-glance UI cards, configuring data source bindings to Integration Procedures, or reviewing existing FlexCard definitions for accessibility and performance. TRIGGER when: user creates FlexCards, configures data sources, designs card layouts, or asks about OmniUiCard metadata. DO NOT TRIGGER when: building OmniScripts (use building-omnistudio-omniscript), creating Integration Procedures (use building-omnistudio-integration-procedure), or analyzing dependencies (use analyzing-omnistudio-dependencies)." metadata: version: "1.0"

building-omnistudio-flexcard: OmniStudio FlexCard Creation and Validation

Expert OmniStudio engineer specializing in FlexCard UI components for Salesforce Industries. Generate production-ready FlexCard definitions that display at-a-glance information with declarative data binding, Integration Procedure data sources, conditional rendering, and proper SLDS (Salesforce Lightning Design System) styling. All FlexCards are validated against a 130-point scoring rubric across 7 categories.

Scope

  • In scope: Creating and validating OmniStudio FlexCard definitions (OmniUiCard); configuring Integration Procedure data sources; designing card layouts, states, and action buttons; scoring against the 130-point rubric; deployment and activation
  • Out of scope: Building OmniScripts (use building-omnistudio-omniscript), creating Integration Procedures (use building-omnistudio-integration-procedure), mapping full dependency trees (use analyzing-omnistudio-dependencies), deploying metadata to org (use deploying-metadata)

Core Responsibilities

  1. FlexCard Authoring: Design and build FlexCard definitions with proper layout, states, and field mappings
  2. Data Source Binding: Configure Integration Procedure data sources with correct field mapping and error handling
  3. Test Generation: Validate cards against multiple data states (populated, empty, error, multi-record)
  4. Documentation: Produce deployment-ready documentation with data source lineage and action mappings

Document Map

NeedDocumentDescription
Best practicesreferences/best-practices.mdLayout patterns, SLDS, accessibility, performance
Data bindingreferences/data-binding-guide.mdIP sources, field mapping, conditional rendering

CRITICAL: Orchestration Order

FlexCards sit at the presentation layer of the OmniStudio stack. Ensure upstream components exist before building a FlexCard that depends on them.

analyzing-omnistudio-dependencies → building-omnistudio-datamapper → building-omnistudio-integration-procedure → building-omnistudio-omniscript → building-omnistudio-flexcard (you are here)

FlexCards consume data from Integration Procedures and can launch OmniScripts. Build the data layer first, then the presentation layer.


Key Insights

InsightDetail
Configuration fieldsOmniUiCard uses DataSourceConfig for data source bindings and PropertySetConfig for card layout, states, and actions. There is NO Definition field on OmniUiCard in Core namespace.
Data source bindingData sources bind to Integration Procedures for live data; the IP must be active and deployed before the FlexCard can retrieve data
Child card embeddingFlexCards can embed other FlexCards as child cards, enabling composite layouts with shared or independent data sources
OmniScript launchingFlexCards can launch OmniScripts via action buttons, passing context data from the card's data source into the OmniScript's input
Designer virtual objectThe FlexCard Designer uses OmniFlexCardView as a virtual list object (/lightning/o/OmniFlexCardView/home), separate from the OmniUiCard sObject where card records are stored. Cards created via API may not appear in "Recently Viewed" until opened in the Designer.

Workflow (5-Phase Pattern)

Phase 1: Requirements Gathering

Before building, clarify these with the stakeholder:

QuestionWhy It Matters
What is the card's purpose?Determines layout type and data density
Which data sources are needed?Identifies required Integration Procedures
What object context does it run in?Determines record-level vs. list-level display
What actions should the card expose?Drives button/link configuration and OmniScript integration
What layout best fits the use case?Single card, list, tabbed, or flyout
Are there conditional display rules?Fields or sections that appear/hide based on data values

Phase 2: Design & Layout

Read references/best-practices.md for layout patterns, SLDS compliance, accessibility requirements, and performance guidance before designing.

Card Layout Options

Layout TypeUse CaseDescription
Single CardRecord summaryOne card displaying fields from a single record
Card ListRelated recordsRepeating cards bound to an array data source
Tabbed CardMulti-contextMultiple states displayed as tabs within one card
Flyout CardDetail on demandExpandable detail panel triggered from a summary card

Data Source Configuration

Each FlexCard data source connects to an Integration Procedure (or other source type) and maps response fields to display elements.

FlexCard → Data Source (type: IntegrationProcedure)
         → IP Name + Input Mapping
         → Response Field Mapping → Card Elements
  • Map IP response fields to card display elements using {datasource.fieldName} merge syntax
  • Configure input parameters to pass record context (e.g., {recordId}) to the IP
  • Set data source order when multiple sources feed the same card

Action Button Design

Action TypePurposeConfiguration
Launch OmniScriptStart a guided processOmniScript Type + SubType, pass context params
NavigateGo to record or URLRecord ID or URL template with merge fields
Custom ActionPlatform event, LWC, etc.Custom action handler with payload mapping

Conditional Visibility

  • Show/hide fields based on data values using visibility conditions
  • Show/hide entire card states based on data source results
  • Display empty-state messaging when data source returns no records

Phase 3: Generation & Validation

Read references/data-binding-guide.md for merge field syntax, data source types, and multi-source coordination before generating. Read references/scoring-rubric.md for the full point-by-point breakdown when running the 130-point validation.

  1. Generate the FlexCard definition JSON
  2. Validate all data source references resolve to active Integration Procedures
  3. Run the 130-point scoring rubric (see Scoring section below)
  4. Verify merge field syntax matches IP response structure
  5. Check accessibility attributes on all interactive elements

Phase 4: Deployment

  1. Ensure all upstream Integration Procedures are deployed and active
  2. Run a dry-run check: use the deploying-metadata skill with --dry-run before committing
  3. Deploy the FlexCard metadata (OmniUiCard) — sf project deploy start is safe to re-run; it upserts existing records
  4. Activate the FlexCard in the target org
  5. Embed the FlexCard in the target Lightning page, OmniScript, or parent FlexCard
  6. If deploy fails: check error output for specific cause — common issues: upstream IP not deployed (Cannot find OmniIntegrationProcedure), missing namespace prefix (Entity not found), or FlexCard still in Draft status (activate before retrieving)

Phase 5: Testing

Test each FlexCard against multiple data scenarios:

ScenarioWhat to Verify
Populated dataAll fields render correctly, merge fields resolve
Empty dataEmpty-state message displays, no broken merge fields
Error stateGraceful handling when IP returns an error or times out
Multi-recordCard list renders correct number of items, pagination works
Action buttonsOmniScript launches with correct pre-populated data
Conditional fieldsVisibility rules toggle correctly based on data values
MobileCard layout adapts to smaller viewport widths

Generation Guardrails

Avoid these patterns when generating FlexCard definitions:

Anti-PatternWhy It's WrongCorrect Approach
Referencing non-existent IP data sourcesCard fails to load data at runtimeVerify IP exists and is active before binding
Hardcoded colors in stylesBreaks SLDS theming and dark modeUse SLDS design tokens and CSS custom properties
Missing accessibility attributesFails WCAG complianceAdd aria-label, role, and keyboard handlers
Excessive nested child cardsPerformance degrades with deep nestingLimit to 2 levels of nesting; flatten where possible
Ignoring empty statesBroken UI when data source returns no recordsConfigure explicit empty-state messaging
Hardcoded record IDsCard breaks across environmentsUse merge fields and context-driven parameters

Scoring Rubric (130 Points)

All FlexCards are validated against 7 categories. Thresholds: ✅ 90+ (Deploy) | ⚠️ 67-89 (Review) | ❌ <67 (Block - fix required)

CategoryPointsCriteria
Design & Layout25Appropriate layout type, logical field grouping, responsive design, consistent spacing, clear visual hierarchy
Data Binding20Correct IP references, proper merge field syntax, input parameter mapping, multi-source coordination
Actions & Navigation20Action buttons configured correctly, OmniScript launch params mapped, navigation targets valid, action labels descriptive
Styling20SLDS tokens used (no hardcoded colors), consistent typography, proper use of card/tile patterns, dark mode compatible
Accessibility15aria-label on interactive elements, keyboard navigable actions, sufficient color contrast, screen reader friendly field labels
Testing15Verified with populated data, empty state, error state, multi-record scenario, and mobile viewport
Performance15Data source calls minimized, child card nesting limited (max 2 levels), no redundant IP calls, lazy loading for non-visible states

Read references/scoring-rubric.md for the full per-criterion breakdown of all 7 categories.


CLI Commands

Read scripts/flexcard-commands.sh for all FlexCard CLI commands (query, retrieve, deploy). Replace <org> with your org alias and <Name> with the FlexCard API name.


Data Source Binding

FlexCard Data Source Configuration

The DataSourceConfig field on OmniUiCard contains the data source bindings as JSON. The PropertySetConfig field contains the card layout, states, and field definitions.

IMPORTANT: There is NO Definition field on OmniUiCard in Core namespace. Use DataSourceConfig for data sources and PropertySetConfig for layout.

Read assets/omni-ui-card.json for the complete OmniUiCard record template including the DataSourceConfig JSON structure.

Data Source Types

TypedataSource.typeWhen to Use
Integration ProcedureIntegrationProcedures (plural, capital P)Primary pattern; calls an IP for live data
SOQLSOQLDirect query (use sparingly; prefer IP for abstraction)
Apex RemoteApexRemoteCustom Apex class invocation
RESTRESTExternal API call via Named Credential
CustomCustomCustom data provider (pass JSON body directly)

Field Mapping from IP Response

Map IP response fields to card display elements using merge field syntax:

IP Response:                    FlexCard Merge Field:
─────────────                   ─────────────────────
{ "Name": "Acme Corp" }   →    {Name}
{ "Account": {            →    {Account.Name}
    "Name": "Acme Corp"
  }
}
{ "records": [             →    {records[0].Name}  (single)
    { "Name": "Acme" }          or iterate with Card List layout
  ]
}

Input Parameter Mapping

Pass context from the hosting page into the IP data source:

Context VariableSourceExample
{recordId}Current record pagePass to IP to query related data
{userId}Running userFilter data by current user
{param.customKey}URL parameter or parent cardPass from parent FlexCard or URL

Cross-Skill Integration

SkillRelationship to building-omnistudio-flexcard
building-omnistudio-integration-procedureBuild the IP data sources that FlexCards consume
building-omnistudio-omniscriptBuild the OmniScripts that FlexCard action buttons launch
building-omnistudio-datamapperBuild DataRaptors/DataMappers that IPs use under the hood
analyzing-omnistudio-dependenciesAnalyze dependency chains across FlexCards, IPs, and OmniScripts
deploying-metadataDeploy FlexCard metadata along with upstream dependencies
generating-lwc-componentsBuild custom LWC components embedded within FlexCards

Gotchas

ScenarioHandling
Empty dataConfigure an explicit empty-state with a user-friendly message; do not show raw "No data" or blank card
Error statesDisplay a meaningful error message when the IP data source fails; log the error for debugging
Mobile responsivenessUse single-column layout for mobile; avoid horizontal scrolling; test at 320px viewport width
Long text valuesTruncate with ellipsis and provide a flyout or tooltip for full text
Large record setsUse card list with pagination; limit initial load to 10-25 records
Null field valuesUse conditional visibility to hide fields with null values rather than showing empty labels
Mixed data freshnessWhen multiple data sources have different refresh rates, display a "last updated" indicator

FlexCard vs LWC Decision Guide

FactorFlexCardLWC
Build methodDeclarative (drag-and-drop)Code (JS, HTML, CSS)
Data bindingIntegration Procedure merge fieldsWire service, Apex, GraphQL
Best forAt-a-glance information displayComplex interactive UIs
TestingManual + data state verificationJest unit tests + manual
CustomizationLimited to OmniStudio frameworkFull platform flexibility
ReuseEmbed as child cardsImport as child components
When to chooseStandard card layouts with IP dataCustom behavior, animations, complex state

Dependencies

Required: Target org with OmniStudio (Industries Cloud) license, sf CLI authenticated For Data Sources: Active Integration Procedures deployed to the target org For Actions: Active OmniScripts deployed (if action buttons launch OmniScripts) Scoring: Block deployment if score < 67

Idempotency: sf project deploy start upserts metadata — safe to re-run without creating duplicates. Query first to confirm current state: see scripts/flexcard-commands.sh.

Namespace handling: In managed-package orgs, the metadata type may be prefixed (e.g., omnistudio__OmniUiCard). Check sfdx-project.json for the namespace. See scripts/flexcard-commands.sh for the namespaced deploy command.

Creating FlexCards programmatically: Use REST API (sf api request rest --method POST --body @file.json). Required fields: Name, VersionNumber, OmniUiCardType (e.g., Child). Set DataSourceConfig (JSON string) for data source bindings and PropertySetConfig (JSON string) for card layout. The sf data create record --values flag cannot handle JSON in textarea fields. Activate by updating IsActive=true after creation.


Output Expectations

Deliverables produced by this skill:

  • FlexCard JSON definition (assets/omni-ui-card.json template) — OmniUiCard record ready for REST API creation or metadata deployment
  • Data source binding blockDataSourceConfig JSON mapping Integration Procedure inputs and response fields to card elements
  • Card layout configPropertySetConfig JSON defining card states, field display, conditional visibility, and action buttons
  • Validation report — 130-point score across 7 categories with deploy/review/block threshold result
  • Deployment checklist — confirms upstream IPs are active, FlexCard is activated, and embedded in target Lightning page or parent FlexCard

External References

  • OmniStudio FlexCards (Trailhead) — Official learning module for FlexCard fundamentals and guided setup
  • OmniStudio Developer Guide — Technical reference for FlexCard metadata, data source configuration, and component properties
  • Salesforce Industries Documentation — FlexCard configuration guide covering layout, states, and actions

Reference File Index

FileWhen to read
assets/omni-ui-card.jsonPhase 3 — Generation: OmniUiCard record template including DataSourceConfig JSON structure
references/best-practices.mdPhase 2 — Layout patterns, SLDS compliance, accessibility requirements, and performance guidance
references/data-binding-guide.mdPhase 2-3 — Data source types, merge field syntax, input parameter mapping, and multi-source coordination
references/scoring-rubric.mdPhase 3 — Full per-criterion breakdown of all 7 scoring categories (130 points)
scripts/flexcard-commands.shPhase 4 — All CLI commands for querying, retrieving, and deploying FlexCard metadata

Related skills

More from forcedotcom/sf-skills and the wider catalog.

GE

generating-apex

forcedotcom/sf-skills

Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex.

2.6k installsAudited
GE

generating-apex-test

forcedotcom/sf-skills

Generate and validate Apex test classes with TestDataFactory patterns, bulk testing (251+ records), mocking strategies, assertion best practices, and disciplined test-fix loops. Use this skill when creating new Apex test classes, improving test coverage, debugging and fixing failing Apex tests, running test execution and coverage analysis, or implementing testing patterns for triggers, services, controllers, batch jobs, queueables, and integrations. Triggers on *Test.cls, *_Test.cls files, sf apex run test workflows, coverage reports, test-fix loops. Do NOT trigger for production Apex code (use generating-apex) or Jest/LWC tests.

2.6k installsAudited
GE

generating-lwc-components

forcedotcom/sf-skills

Lightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.

2.6k installsAudited
GE

generating-flow

forcedotcom/sf-skills

Generate Salesforce Flows using the MCP tool execute_metadata_action. Use when the user asks to create, build, or generate a flow — including Screen, Autolaunched, Record-Triggered (before/after-save), Scheduled. Also trigger for flow-like requests such as \"when a record is created\", \"trigger daily at\", \"send an email when\", \"update the field when\", \"automate\", \"workflow\", or \"flow XML/metadata\". This is the only skill for Salesforce Flow generation.

2.5k installsAudited
QU

querying-soql

forcedotcom/sf-skills

SOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.

2.5k installsAudited
GE

generating-custom-object

forcedotcom/sf-skills

Use this skill when users need to create, generate, or validate Salesforce Custom Object metadata. Trigger when users mention custom objects, creating objects, object metadata, .object files, sharing models, name fields, or validation rules on objects. Also use when users say things like \"create a custom object\", \"generate object metadata\", \"set up an object for...\", or when they're troubleshooting object deployment errors especially around sharing models and Master-Detail relationships. Always use this skill for any custom object metadata work.

2.5k installsAudited