
Using Ui Bundle Salesforce Data
Look up Salesforce GraphQL types, filters, and CRUD inputs from schema.graphql when building UI bundles on Salesforce data.
Install
npx skills add https://github.com/forcedotcom/sf-skills --skill using-ui-bundle-salesforce-dataWhat is this skill?
- Bash helper to search schema.graphql for one or more Salesforce entities
- Surfaces type definitions, Filter inputs, OrderBy, and create/update mutation shapes
- Runs from SFDX project root with optional custom `--schema` path
- Documents seven output sections per entity for UI-bundle GraphQL work
- Strict bash mode (`set -euo pipefail`) for predictable script failures
Adoption & trust: 645 installs on skills.sh; 513 GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Journey fit
Salesforce UI data wiring happens during Build when you connect experience layers to org schema and mutations—not during idea research or post-launch SEO. Integrations is the right shelf because the skill centers on schema.graphql entity lookup for queries, filters, orderBy, and create/update representations.
Common Questions / FAQ
Is Using Ui Bundle Salesforce Data safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Using Ui Bundle Salesforce Data
#!/usr/bin/env bash set -euo pipefail # exit on error (-e), undefined vars (-u), and propagate pipeline failures (-o pipefail) # graphql-search.sh — Look up one or more Salesforce entities in schema.graphql. # # Run from the SFDX project root (where schema.graphql lives): # bash scripts/graphql-search.sh Account # bash scripts/graphql-search.sh Account Contact Opportunity # # Pass a custom schema path with -s / --schema: # bash scripts/graphql-search.sh -s /path/to/schema.graphql Account # bash scripts/graphql-search.sh --schema ./other/schema.graphql Account Contact # # Output sections per entity: # 1. Type definition — all fields and relationships # 2. Filter options — <Entity>_Filter input (for `where:`) # 3. Sort options — <Entity>_OrderBy input (for `orderBy:`) # 4. Create mutation wrapper — <Entity>CreateInput # 5. Create mutation fields — <Entity>CreateRepresentation (for create mutations) # 6. Update mutation wrapper — <Entity>UpdateInput # 7. Update mutation fields — <Entity>UpdateRepresentation (for update mutations) SCHEMA="./schema.graphql" # ── Argument parsing ───────────────────────────────────────────────────────── while [[ $# -gt 0 ]]; do case "$1" in -s|--schema) if [[ -z "${2-}" || "$2" == -* ]]; then echo "ERROR: --schema requires a file path argument" exit 1 fi SCHEMA="$2" shift 2 ;; --) shift break ;; -*) echo "ERROR: Unknown option: $1" echo "Usage: bash $0 [-s <schema-path>] <EntityName> [EntityName2 ...]" exit 1 ;; *) break ;; esac done if [ $# -eq 0 ]; then echo "Usage: bash $0 [-s <schema-path>] <EntityName> [EntityName2 ...]" echo "Example: bash $0 Account" echo "Example: bash $0 Account Contact Opportunity" echo "Example: bash $0 --schema /path/to/schema.graphql Account" exit 1 fi if [ ! -f "$SCHEMA" ]; then echo "ERROR: schema.graphql not found at $SCHEMA" echo " Make sure you are running from the SFDX project root, or pass the path explicitly:" echo " bash $0 --schema <path/to/schema.graphql> <EntityName>" echo " If the file is missing entirely, generate it from the UI bundle dir:" echo " cd force-app/main/default/uiBundles/<app-name> && npm run graphql:schema" exit 1 fi if [ ! -r "$SCHEMA" ]; then echo "ERROR: schema.graphql is not readable at $SCHEMA" echo " Check file permissions: ls -la $SCHEMA" exit 1 fi if [ ! -s "$SCHEMA" ]; then echo "ERROR: schema.graphql is empty at $SCHEMA" echo " Regenerate it from the UI bundle dir:" echo " cd force-app/main/default/uiBundles/<app-name> && npm run graphql:schema" exit 1 fi # ── Helper: extract lines from a grep match through the closing brace ──────── # Prints up to MAX_LINES lines after (and including) the first match of PATTERN. # Uses a generous line count — blocks are always closed by a "}" line. extract_block() { local label="$1" local pattern="$2" local max_lines="$3" local match local grep_exit=0 match=$(grep -nE "$pattern" "$SCHEMA" | head -1) || grep_exit=$? if [ "$grep_exit" -eq 2 ]; then echo " ERROR: grep failed on pattern: $pattern" >&2 return 1 fi if [ -z "$match" ]; then echo " (not found: $pattern)" return 3 fi echo "### $label" grep -E "$pattern" "$SCHEMA" -A "$max_lines" | \ awk '/^\}$/{print; exit} {print}' | \ head -n "$max_lines" || true echo "" } # ── Main loop ──────────────────────────────────────────────────────────────── for ENTITY in "$@"; do # Validate entity name: must be a valid PascalCase identifier (letters, digits, underscores) if [[ ! "$ENTITY" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then echo "ERROR: Invalid entity name: '$ENTITY'" echo " Entity names must start with a letter or underscore, followed by letters, digits, or underscores." echo " Examples: Account, My_Custom_Object__c" continue fi echo "" ech