Field service data capture form editor configure

From forcedotcom/sf-skills · View interactive version

Field service data capture form editor configure is an AI agent skill from the GitHub repository forcedotcom/sf-skills. Patch an existing Data Capture Flow that's already deployed in a connected Salesforce org. Retrieves the live Flow Metadata JSON via the Tooling API, applies the user's requested change, and PATCHes it back. Use when the user names an existing flow and asks to add/remove/rename a field, change visib

How to use this skill

Skill file

Edit a Data Capture Form (in an org)

This skill patches a flow that already exists in a connected org. The source of truth is the deployed flow's Metadata JSON, retrieved live from the Tooling Flow sObject — there is no spec file, no .flow-meta.xml, no zip, no SFDX project. The skill retrieves the JSON, edits it in memory, and PATCHes it back.

Runtime contract: every org interaction in this skill is a REST call

dispatched through the Codey runtime (dispatch locally / the hosted

Headless 360 MCP in shared surfaces). This skill has **no dependency on the

execution environment** — no sf CLI, no local Python, no temp files, no

scratch SFDX project. Auth probes, the flow retrieve, and the redeploy are

single REST calls; the JSON patch is authored by the agent inline. Do not

shell out.

When this skill fires

If the user is starting from scratch (prose, PDF, image), route to a design-* skill instead.

Workflow

1. Verify org auth

Confirm the connected org is reachable with a cheap auth probe — dispatch SELECT Id FROM Organization LIMIT 1 (GET /services/data/vXX.0/query):

2. Retrieve the live flow's Metadata JSON

The Tooling Flow sObject exposes the flow definition as a JSON Metadata field — the same shape the deployer assembles and POSTs. Retrieving is a two-call round-trip, no CLI and no file:

  1. Resolve the latest version id from the API name. Dispatch GET /services/data/vXX.0/tooling/query with:

```sql

SELECT Id, ActiveVersionId, LatestVersionId FROM FlowDefinition WHERE DeveloperName = '<FlowApiName>'

```

Edit the latest version (LatestVersionId) so the patch builds on the newest draft, not a stale active version. If LatestVersionId is null, fall back to ActiveVersionId.

  1. Read the Metadata blob. Dispatch GET /services/data/vXX.0/tooling/sobjects/Flow/<versionId> and take the Metadata object from the response. This JSON is the flow — screens, choices, decisions, variables, and the post-screen chain. See ../fs-data-capture-form-deployer/reference/flow-metadata-json.md for the shape.

If the FlowDefinition query returns zero rows, the API name is wrong or the user is pointed at the wrong org. Confirm with the user before retrying. List the candidate flows in the org if useful — dispatch GET /services/data/vXX.0/tooling/query with SELECT DeveloperName FROM FlowDefinition ORDER BY DeveloperName.

3. Read the retrieved Metadata JSON and the rule sheet

Before patching, read the retrieved Metadata JSON to understand the current structure, then read fs-data-capture-reference/SKILL.md for the platform's hard constraints. The constraints are identical whether the flow is expressed as XML or JSON — a repeated XML element is a JSON array, so "grouping" becomes "the array" (see the JSON↔XML mapping rule in ../fs-data-capture-form-deployer/reference/flow-metadata-json.md). Pay particular attention to:

The prohibited-patterns table at the bottom of fs-data-capture-reference/SKILL.md is the fastest reference for "what would break this patch".

4. Plan the patch and confirm with the user

Before editing, tell the user:

  1. What you're going to change — specific element, specific lines (cite path:line references), and what the result will look like.
  2. Whether the change requires schema reordering — e.g. adding a new <recordLookups> element when none exist requires placing it in the right group. Call this out.
  3. Activation status risk — patches deploy as a new draft version of the flow. The active version (if any) keeps running until the user activates the new draft in Flow Builder. Tell the user this.
  4. Anything you noticed that's worth flagging — pre-existing issues, deprecated patterns, validation rules that look broken. Don't auto-fix unrelated issues; surface them.

Use AskUserQuestion to gate the edit. Options:

Do not proceed to step 5 without explicit approval.

5. Apply the patch

Edit the in-memory Metadata JSON object retrieved in step 2. Some specific guidelines:

6. Redeploy via a Tooling PATCH

Push the edited flow back as a new draft version with a single Tooling API call — dispatch PATCH /services/data/vXX.0/tooling/sobjects/Flow/<versionId> with body:

{ "Metadata": { "...the full edited Metadata object..." } }

7. Report back

On success:

On failure (the PATCH returned a 400 — read the error from the response body's message):

Out of scope

Related skills

Files in this skill

This skill has no executable scripts. The auth probe, the flow retrieve (GET /tooling/sobjects/Flow/{id}), and the redeploy (PATCH /tooling/sobjects/Flow/{id}) are all single REST calls dispatched through the Codey runtime. The JSON patch is authored by the agent inline against ../fs-data-capture-form-deployer/reference/flow-metadata-json.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.