Skip to main content
예상 시간

Add a Flow to Your Prompt Template

In the resort, often more than one event happens during a guest’s stay. Next, create a flow to include all the experiences that guests can participate in during their stay. To do this, you create a Template-Triggered Prompt Flow.

Create a Template-Triggered Prompt Flow

  1. Click gear icon and click Setup. The Setup page opens in a new tab.
  2. In the Quick Find box, enter flows, then click Flows.
  3. Click New Flow, Start From Scratch, then Next.

Flow Builder menu with new flow options. Start from Scratch is highlighted.

  1. For the type, select Template-Triggered Prompt Flow, and click Create.

Flow Builder Menu with flows options. Template-Triggered Prompt Flow is highlighted.

Flow Builder opens.

  1. Leave the input type Manual Inputs.

Select Input Type Menu with options for manual or automatic inputs.

  1. Select Toggle Toolbox.

Toggle Toolbox button on upper left side of Flow Builder screen.

  1. Click New Resource and enter the following details:
    • Resource Type: Variable
    • API Name: Reservation
    • Data Type: Record
    • Object: External Reservation
    • Available for input: Checked
  2. Click Done.

New Resource screen with details from instructions added.

  1. Click New Resource again and enter the following details:
    • Resource Type: Variable
    • API Name: Experience
    • Data Type: Record
    • Object: Experience
    • Available for input: Checked
  2. Click Done.
  3. Click Save to save the flow.
  4. The Save the flow window appears. This is where you assign the flow details to the model. Enter the following into each field:
    • Flow Label: Get Experience Newsletter Data
    • Flow API Name: Get_Experience_Newsletter_Data
    • Description: Filter all guest experience data to return to guests.
  5. Click Save.

Add Elements to the Prompt Flow

  1. Click the plus icon (Add Element) between Start and End.
  2. In the Add Element box, type Get Records and select the element Get Records to retrieve and store the experiences in a collection.
  3. Enter Guest Experience in the Label field, and Guest_Experience for the API Name.
  4. In the description field add, Get all experience data.
  5. Select Experience from the Object field. The newsletter needs to include only the events that guests can participate in during their stay.
  6. In the Condition Requirements, select None - Get All Experience Records.
  7. In the Sort Order drop down, select Not Sorted.
  8. Select All records in the How Many Records to Store.
  9. Click Save.

Currently all of the experiences are stored in a collection. To look at each item individually let’s add a loop.

  1. Back in the flow, click the plus icon (Add Element) after the Get Records element.
  2. Add a Loop element by typing Loop and selecting it.
  3. Enter Loop Experiences in the Label field and Loop_Experiences for the API Name field.
  4. Enter Loop through the collection of guest experiences. in the Description field.
  5. In the Collection Variable field, select Experiences from Guest Experience.
  6. Click Save.

Template-triggered flows offer a unique capability: creating prompt instructions. These instructions gather and pass data and text from Flow Builder to Prompt Builder. In the next step, you use prompt instructions to format all of the experience details to send to Prompt Builder and activate the flow to use within Prompt Builder.

  1. After the For Each path of the Loop element, click the plus icon (Add Element). Type add and select the Add Prompt Instructions element to add to the flow.
  2. Enter Send Experience Details to the Prompt Template in the label field and Send_Experience_Details_to_the_Prompt_Template in the API Name field.
  3. Enter Add all qualifying experience details to the prompt instructions. in the Description field.
  4. Paste the following text in the Prompt Instructions field (below the search box labeled Insert a resource…).
(Experience Name: {!Loop_Experiences.Name},
 Experience Location:{!Loop_Experiences.Location__c} ,
 Experience Details: {!Loop_Experiences.Description__c})
  1. Click Save, then Activate.
    Flow Builder displaying the final Get Event Newsletter Data Flow.

Add the Flow to Your Prompt Template

Since your flow has been activated in Flow Builder, it’s now ready to use in Prompt Builder.

  1. Exit Flow Builder, then click Setup. Click gear icon and click Setup.
  2. In the Quick Find box, enter prompt, then click Prompt Builder.
  3. Select the prompt template, New Guest Newsletter.
  4. Let’s replace the existing Experience merge fields with the flow. First, select and delete the following text:
    Experience Name: Input:Experience.Name
    Experience Location: Input:Experience.Location__c
    Experience Details: Input:Experience.Description__c
  1. Then, replace the text by clicking in the Resource field, and selecting Flows > Get Experience Newsletter Data.
  2. Click Save As, then Save as a New Version.

Your prompt template should look like this.

Flex prompt template with the flow merge field replacing the three deleted merge fields.

Test the Prompt

  1. In the Reservation field type, er. Select any reservation.
  2. In the Experience field type, Family. Select Family Karaoke Night.
  3. Click Preview.
  4. Take a look at the output of your prompt template.
  5. Click Activate.

Great work! You've quickly learned how to craft a prompt template tailored to your needs. By incorporating flows, you've made your templates even more user-friendly for everyone. Keep exploring Prompt Builder to uncover more creative ways to automate text generation.

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기