Skip to main content

Prompt Action Framework in GPTfy

Overview

The Prompt Action Framework in GPTfy allows you to automate actions directly from a prompt run. These actions are configured per prompt and defined in the Actions Tab during prompt setup.


Adding Actions

  1. Locate the Actions Tab:
    Open or create a prompt and navigate to the Actions tab.

alt text

  1. Add Actions:
    Click the plus (+) icon to open a dropdown of available action types.

alt text

  1. Configure Actions:
    Each action type has a dedicated configuration window.

alt text

⚠️ One can’t create, update, or delete an action when the prompt is activated.


Available Actions

1. Update Field

This action updates a field on the record where the prompt is run with the corresponding AI response.

alt text

Steps to Configure:

  • Select Update Field from the dropdown
  • Configure in the pop-up window:
    • Action Type
    • Description
    • Sequence (execution order)
    • AI Response (can use JSON nodes for JSON prompts)
    • Field to be updated
    • Append Timestamp (optional)

alt text


2. Create Record

This action allows the creation of a new record for a specified object.

alt text

Steps to Configure:

  • Select Create Record from the dropdown
  • Configure in the pop-up window:
    • Action Type
    • Description
    • Sequence
    • Object
    • Field Mapping:
      • Hardcoded: Manual entry
      • Reference Field: From current record
      • AI Response: Supports JSON components for JSON prompts
    • Add/Remove Fields

alt text


3. Invoke Flow

This action triggers a Salesforce Flow.

alt text

Steps to Configure:

  • Select Invoke Flow from the dropdown
  • Configure in the pop-up window:
    • Action Type
    • Description
    • Sequence
    • Flow: API name of the flow to invoke

4. Invoke Apex

This action executes a Salesforce Apex class.

alt text

Steps to Configure:

  • Select Invoke Apex from the dropdown
  • Configure in the pop-up window:
    • Action Type
    • Description
    • Sequence
    • Apex Class: API name of the Apex class

5. Open a Form

This action opens a pre-configured form for data entry or updates.

alt text

Steps to Configure:

  • Select Open a Form from the dropdown

alt text

  • Configure in the pop-up window:
    • Action Type
    • Description
    • Sequence
    • Object
    • Field Mapping:
      • Hardcoded
      • Reference Field
      • AI Response
    • Add/Remove Fields

alt text

Once the prompt is run, an Open a Form button appears in the expanded view on the GPTfy console.

alt text

If record types are specified, they will be included automatically, and mapped values will be pre-filled.

alt text

When a prompt is run, actions execute in the specified sequence.
For “Open a Form,” the number of forms displayed corresponds to the number of configured actions.

alt text


Prompt Action Validations

Validation ensures that only valid objects, fields, flows, and classes are used at the time of prompt activation, reducing runtime errors.

ActionValidation
Flow ActionMust reference an active Auto-Launched Flow.
SOQL Check:
SELECT Id, ApiName, NamespacePrefix FROM FlowDefinitionView WHERE IsActive = True AND ProcessType = 'AutoLaunchedFlow'
Apex ClassApex class must exist in the org. Activation fails if missing.
Update FieldField must exist and be accessible. Mapped prompt components must be valid.
Create RecordObject and fields must exist. Field mapping must reference valid components.
Open a FormSame as Create Record. Object and fields must be valid and mapped.

Example Test Scenarios

  • Flow: Add an inactive or non-Auto-Launched flow → Activation fails
  • Apex Class: Reference a non-existent class → Activation fails
  • Update Field: Remove mapped field or FLS access → Activation fails
  • Create Record: Delete the object or a mapped field → Activation fails
  • Open a Form: Delete the object or a mapped field → Activation fails

Post-Run: Prompt Action Details in Security Audit

After a prompt is run:

  • All prompt actions and their execution statuses are automatically logged in the Security Audit under the Prompt Actions tab.
  • For each action, the audit captures:
    • Action Type (e.g., Update Field, Create Record)
    • Current Status (Success, Error)
    • Error Message (if any)
    • Linked to the Security Audit Record for traceability

This enables easy review of which actions succeeded or failed, enhancing compliance and operational transparency.


Activation Behavior

  • When you activate a prompt:
    • GPTfy validates all configured actions.
    • If any validation fails, activation is blocked with an error message.
    • Once validated, actions execute sequentially when the prompt runs.