---
isPublished: true
knowledgeIndex: false
hidden: true
noindex: true
template: "page.peb"
title: "AI Completion to SObject Action (JSON) Flow Reference"
description: "Inputs, outputs, transaction effects and troubleshooting for AI Completion to SObject Action (JSON) in Salesforce Flow."
contentType: "reference"
audience: "admin,developer"
---

# AI Completion to SObject Action (JSON)

Convert a JSON object or completion key/value results into a Salesforce record.
The namespaced Apex action name is `rooms__AIJSONSObjectAction`.

## Transaction summary

| Effect | Behavior |
| --- | --- |
| API callout | No API callout is made. |
| Record writes | INSERT and UPDATE options write Salesforce records in the calling Flow transaction. With both options disabled, the action can return an unsaved record. |
| Background work | No queued work is started. |
| Platform event | The action does not directly publish a platform event. |
| Email | The action does not send email. |

Use exact field API names in the JSON object. CompletionResults takes precedence over JSON when the collection has values. Use INSERT or UPDATE for persistence. The UPSERT controls are deprecated.

Record writes can prevent a later callout in the same transaction. Do not assume that Success alone means every requested field was mapped. Inspect Fields Updates and the returned record.

## Inputs

Required describes the Flow input setting. Additional conditions are stated in the guidance.

| API name | Flow label | Required | Default or guidance |
| --- | --- | --- | --- |
| `recordId` | Record ID- Record to be UPDATEd (Blank for INSERT) | No | Required for UPDATE. Leave blank for INSERT. |
| `sobjectName` | SObject Name (For INSERT actions) | No | The full SObject API name. Required for INSERT or an unsaved record. |
| `insertAction` | INSERT action | No | Defaults to `false`. Set `true` to insert the parsed record. |
| `updateAction` | UPDATE action | No | Defaults to `false`. Set `true` to update Record ID. |
| `upsertAction` | UPSERT action (Deprecated. Use INSERT or UPDATE.) | No | Deprecated. Use INSERT or UPDATE. |
| `externalField` | UPSERT External Field Name (Deprecated) | No | Deprecated UPSERT option. |
| `completion` | JSON (String) | No | A JSON object with field API names as keys. |
| `completionResults` | CompletionResults (Collection) | No | A key/value result collection. Takes precedence when nonempty. |

## Outputs

| API name | Flow label | Meaning |
| --- | --- | --- |
| `recordId` | Record ID | The record reference when available. For inserts, inspect the returned Record ID as well. |
| `record` | Record (A single JSON parsed record) | The parsed record and mapped fields. Confirm whether a persistence option was used. |
| `success` | Success | Whether the action reported success. Check this value before continuing. |
| `message` | Error Message | Result details or an error. Read this value with Success. |
| `fieldUpdateCount` | Fields Updates (Count) | Number of fields mapped during conversion. |

## Configure the Flow

1. Select the target SObject API name and the fields to populate.
2. Supply JSON or CompletionResults.
3. Enable exactly the required INSERT or UPDATE option; leave both disabled for an unsaved record.
4. For UPDATE, supply Record ID. For INSERT or an unsaved record, supply SObject Name.
5. Check Success, Error Message, returned Record and Fields Updates before continuing.

Confirm the Flow user's action access and the required access to the referenced records.
Review the configured Salesforce API connection user's access when the action makes a callout.
Connect the action's Fault path.

## Troubleshooting

**No fields matched.** Use exact field API names and compatible values. Check that the input is a JSON object.

**A later callout reports uncommitted work.** This action may have written records. Review the later action's transaction boundary.

**Only some records succeeded.** Inspect each returned result and the actual records before retrying inserts.

Confirm that the action and its fields exist in the installed package.
See the [Flow action index](/content/build/flows/index.md) for related actions and transaction guidance.
