Salesforce Flow - Auto Create Projects from Opportunities

    You can use Salesforce Flows to automatically generate Projects from Opportunities. This article guides you through the steps to set up this automation.

     

    Step 1: Add a Custom Field on the Opportunity

    In this section, you’ll create a new checkbox field on the Opportunity object called Project Auto Created. This field will act as a flag to show whether a project has already been generated by the flow. The flow will use this flag each time the Opportunity is updated to decide if a new project should be created. By doing this, you prevent the flow from creating multiple projects whenever the Opportunity record is edited.

     

    1. Click on the Gear Icon in the top right corner and go to Setup.


       
    2. Go to Object Manager.


       
    3. Enter "Opportunity" in the Quick Find box at the top right and click on Opportunity.


       
    4. Go to Fields & Relationships in the menu on the left and click on New.


       
    5. Select "Checkbox" as the field type and click on Next.


       
    6. Populate the following information:

      Field Label - enter "Project Auto Created"
      Default Value - select "Unchecked"
      Field Name - will auto-populate from Field Label 
      Description (optional)
      Help Text (optional)

      Then click on Next.


       
    7. Set the field to Visible for all profiles and click on Next.


       
    8. Select the page layouts where the field needs to be added and click on Save.


       

    Step 2: Create Flow using Salesforce Flow Builder

    In this section, you’ll learn how to create a flow that automatically generates Projects from Opportunities based on specified criteria.

     

    Step 2.1: Create Flow and Define Criteria

    The first step is to create a new flow and specify the conditions that will trigger it.

     

    1. While still in Setup, enter "Flows" in the Quick Find box and click on Flows.


       
    2. Next, click on New Flow.


       
    3. Select Triggered as the category.


       
    4. Then, select Record-Triggered Flow as the type.


       
    5. For Object, select Opportunity. Under "Configure Trigger", select "a record is created or edited".


       
    6. Under Set Entry Conditions, define the criteria for when a new Project should be created. In this example, we’ll configure the flow to create a Project when the Opportunity Stage is changed to Closed Won. Additionally, we’ll add a condition to check that the Project Auto Created field on the Opportunity is not selected (i.e., not TRUE).

      First, set Condition Requirements to All Conditions Are Met (AND)

      And then, set the following criteria.

      Criteria 1: [Opportunity] Stage equals Closed Won
      Criteria 2: [Opportunity] Project Auto Created equals False


       
    7. Set When to Run the Flow for Updated Records to Every time a record is updated and meets the condition requirements.


       
    8. Set Optimize the Flow for to Actions and Related Records.

     

    Step 2.2: Add Elements to Your Flow

    In this section, you’ll learn how to add and configure elements in your Salesforce Flow. Flow elements define the actions, logic, and decisions your automation will perform. 

     

    1. Click on + Add Element.


       
    2. Select Create Records.


       
    3. Populate the details for creating a new project.

      Label: Create a Project
      Description (optional): Enter a brief description for this element/action
      How to set record field values: Choose "Manually"

      Under Create a Record of This Object, select Project (inspire1__Project__c)


       
    4. Then, set the Field Values for the new project when it is created by the flow.

      Set the following field values:
       
      FieldTypeValueNotes
      Project NameField Reference[Opportunity].nameWill use the opportunity name as the project name. If you want to define a custom naming convention, change the type to Formula and configure it according to your preferred format.
      OpportunityField Reference[Opportunity].Id

      This links the Project to the related Opportunity by populating the Opportunity lookup field.

      AccountField Reference[Opportunity].AccountId

      This links the Project to the related Account by filling the Project’s Account lookup field with the Account associated with its Opportunity.

      Project StatusPicklistNot StartedWill set the project status to "Not Started". You can choose a different default status if preferred.
      Project TemplateIDEnter the Salesforce Id of the template you would like to use

      This determines which project template is applied to the project when it is created.

       

      Make sure users have access to the template.

      *** You can choose to populate other Project fields by assigning values to them.


       
    5. Click on Save when you are finished.


       
    6. You will be prompted to populate a name for the flow.

      Flow Label: Enter "Inspire Planner - Auto Create Project from Opportunity"
      Description (optional): Enter a brief description

      Click on Save.


       
    7. Next, we will need to update the field on the Opportunity called "Project Auto Created" to TRUE after the flow creates the new project. This is to prevent the flow from creating a new project every time the Opportunity is edited. 
       
      Click on + Add Element after (below) the “Create a Project”.


       
    8. Select Update Triggering Record.


       
    9. Populate the details of the element.

      Label: Update Project Auto Created
      Description (optional): Enter a brief description

      Under How to Find Records to Update and Set Their Values, select Use the opportunity record that triggered the flow.


       
    10. Under Set Filter Conditions, set Condition Requirements to Update Record to None-Always Update Record.

      Then, under Set Field Values for the Opportunity Record, select the following:

      Field: select Project Auto Created
      Value: select True

      Click on Save when finished.


    Step 2.3: Activate the Flow

    When all criteria and actions are set, click Activate in the top-right corner to enable the flow. Activated flows cannot be edited, so any future changes will require cloning or creating a new version.

     


    Tags

    Process AutomationAdministration

    « Previous ArticleNext Article »