Create and Configure Opportunity Custom Action

Build an autolaunched flow to automate Opportunity record creation. Next, convert this flow into an Agentforce action.

Required Editions

Available in: Lightning Experience
Available in: Automotive Cloud, Communications Cloud, and Manufacturing Cloud, with Agentforce enabled. View edition availability.

Build the Opportunity Creation Flow

Follow these steps to build an autolaunched flow that creates an Opportunity record.

  1. From Setup, in the Quick Find box, enter Flows, and select Flows.
  2. Click New Flow.
  3. Select Autolaunched Flow (No Trigger) and click Create.
  4. Open the Toolbox (Manager tab) and create the following New Resources in the form of variables.
    • Variable API Name Data Type Availability
      account_id Text Available for input
      opportunity_close_date Date/Time Available for input
      opportunity_stage Text Available for input
      opportunity_name Text Available for input
      opportunity_id Text Available for output
  5. From the canvas, add a Create Records element using these inputs.
    • Label: Create Opportunity
    • How to Set Record Fields: Select Use separate resources, and literal values.
    • Object: Select Opportunity
    • Set Field Values for the Opportunity: Map the Opportunity fields to the variables created in Step 4.
    Field Value
    Account ID account_id
    Close Date opportunity_close_date
    Stage opportunity_stage
    Name opportunity_name
    Additional Configuration  
    Store Opportunity ID in Variable opportunity_id
  6. Save the flow with a distinct label. For example, Create Opportunity Flow ASLM.
  7. Click Activate.

Create and Configure the Custom Agent Action

Convert the New Opportunity Flow into an Agent Action for use with Agentforce.

  1. From Setup, navigate to Agent Actions.
  2. Click New Agent Action.
  3. For Reference Action Type, select Flow.
  4. In the Reference Action field, search for and select the Create New Opportunity flow you have created.
  5. Ensure the Action Label is clear and user-friendly. For example, Create Opportunity.
  6. Verify that the Input and Output parameters from the CReate New Opportunity flow are correctly exposed.
  7. Configure the action to accept these input parameters.
    Parameter Name Data Type Description
    AccountId String/ID 18-character Account record ID.
    Name String The name of the Opportunity.
    StageName String The specific stage name, for example, "Qualification".
    CloseDate Date The intended close date for the Opportunity.
  8. Set up the logic to insert a new Opportunity record using these input parameters.
  9. Map the ID of the newly created record to the opportunityId output parameter.
    Parameter Name Data Type Description
    opportunityId String/ID 18-character ID of the newly created Opportunity record.
    Note
    Note Save the

    opportunityId

    output — you'll need it as an input parameter when running the Create Initial Quote Revenue action later.