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.
- From Setup, in the Quick Find box, enter Flows, and select Flows.
- Click New Flow.
- Select Autolaunched Flow (No Trigger) and click Create.
-
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
-
-
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 - Save the flow with a distinct label. For example, Create Opportunity Flow ASLM.
- Click Activate.
Create and Configure the Custom Agent Action
Convert the New Opportunity Flow into an Agent Action for use with Agentforce.
- From Setup, navigate to Agent Actions.
- Click New Agent Action.
- For Reference Action Type, select Flow.
- In the Reference Action field, search for and select the Create New Opportunity flow you have created.
- Ensure the Action Label is clear and user-friendly. For example, Create Opportunity.
- Verify that the Input and Output parameters from the CReate New Opportunity flow are correctly exposed.
-
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. - Set up the logic to insert a new Opportunity record using these input parameters.
-
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 Save theopportunityId
output — you'll need it as an input parameter when running the Create Initial Quote Revenue action later.