Skip to main content

Automate the Process

There Once Was a Robot Named Rover, Who Sent a Bunch of Messages Over

Our rover scouts locations on Mars for us, looking for the ideal spot for our Trailhead basecamp. Let’s create a simple way for the rover to tell us what it finds, using an automated process.

  1. In Setup, enter Flows in the Quick Find box, then select Flows.
  2. Click New Flow.
  3. Select Start From Scratch and click Next.
  4. Select Record-Triggered Flow.
  5. Click Create.
  6. In the Objects field, enter communication and select Communication (Communication__c).
  7. Select A record is created.
  8. Select Any Condition Is Met (OR) from the Condition Requirements dropdown.
  9. In the Field lookup, search number and select the Number__c field.
  10. Make sure the Operator is Equals.
  11. In the Value lookup, enter 1.
  12. Click Add Condition.
  13. Add the following:
    • Field: Number__c
    • Operator: Equals
    • Value: 2
  1. Click Add Condition.
  2. Add the following:
    • Field: Number__c
    • Operator: Equals
    • Value: 3
      The Start element's configuration panel corresponding to the preceding steps.
  1. Click Save to save the flow.
  2. Label your new Flow as Mars.
  3. Make sure the API Name is Mars.
  4. Click Save.
    Note: disregard any warnings.

Time to add a decision element.

  1. On the flow canvas, on the Run Immediately path, click Add Element.
  2. Search and select Decision.
  3. Label the new decision element as Mars Messaging.
  4. Make sure Outcome is selected in the Outcome Order.
    New Outcome highlighted on Decision element screen.
  5. Add Message 1 to the Label and Outcome API Name is Message_1.
  6. Make sure Condition Requirements to Execute Outcome is set to All Conditions Are Met (AND).
  7. In the Resource field, select Triggering Communication__c, then select Number.
  8. Make sure the Operator is Equals.
  9. In the Value lookup, search 1 and select the 1 picklist value.
  10. Click the plus icon add outcome icon next to Outcome Order to add another outcome option.
  11. Add the following:
    • Label: Message 2
    • API Name: Message_2
    • Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    • Resource: Triggering Communication__c > Number
    • Operator: Equals
    • Value: 2
  1. In the Outcome Order, click Default Outcome.
  2. Update the Label to Message 3.
  3. Click Close.

Message Setup

Now we’re ready to set up our actions for each message. We start with Message 1.

  1. On the Message 1 path, click Add Element.
    Add element under Message 1 highlighted.
  2. Search chatter and select Post to Chatter.
  3. Label the new action as Message from Mars 1.
  4. Make sure the API Name is Message_from_Mars_1.
  5. For Message, paste in the following:
    Hey, it’s your friendly rover real estate agent here. Today I'm doing some serious {!$Record.Verb__c} over to an area on lower Mount Sharp, heading {!$Record.Direction__c} from my starting location. Since the dune field is an active sand field, it is this Rover's guess that the terrain is {!$Record.Adjective__c} and therefore unsuitable for the Trailblazer basecamp. You know what they say, “Location, location, location.” I will make my final stop for the day at the super {!$Record.Adjective__c} bedrock at the base of Mount Sharp. Roger, Rover. Rover out. P.S. Tell {!$Record.Proper_Noun__c} I said hi.
  6. For Target Name or ID, enter Life on Mars.
  7. Toggle Target Type to Include.
  8. In the Target Type text box, enter Group.
    Completed Message from Mars 1 Post to Chatter screen.
  9. Leave everything else as is, and click Done.
  10. Click Save.

Next up, Message 2.

  1. On the Message 2 path, click Add Element.
  2. Search chatter and select Post to Chatter.
  3. Add the following:
    • Label: Message from Mars 2
    • API Name: Message_from_Mars_2
    • Message:
      New! Mars fixer on majestic Olympus Mons. Bring your hydrospanner and your imagination and make this home your own. What this charmer lacks in curb appeal it more than makes up for in protecting you from the freezing, never ending dust storms. You'll be happier than a {!$Record.Adjective__c} {!$Record.Noun__c} {!$Record.Verb__c} {!$Record.Direction__c}. Drinking water DIY. Serious buyers only. Contact Listing Agent {!$Record.Proper_Noun__c} for details.
    • Target Name or ID: Life on Mars
    • Target Type: Include
    • Target Type text box: Group
  1. Leave everything else as is, and click Done.
  2. Click Save.

And finally, Message 3.

  1. On the Message 3 path, click Add Element.
  2. Search chatter and select Post to Chatter.
  3. Add the following:
    • Label: Message from Mars 3
    • API Name: Message_from_Mars_3
    • Message:
      This planet might be cold, but these deals are hot, hot, hot! Today I was {!$Record.Verb__c} {!$Record.Direction__c} over the hill and found a fabulous new listing for you. It's ideally situated, Schiaparelli Crater-adjacent, with lots of potential. Good natural light and in the best area on Mars. Let's talk soon because {!$Record.Proper_Noun__c} is interested, too. This place is better than a {!$Record.Adjective__c} {!$Record.Noun__c} and is priced to move.
    • Target Name or ID: Life on Mars
    • Target Type: Include
    • Target Type text box: Group
  1. Leave everything else as is, and click Done.
    Screenshot of the completed flow.

If your flow happens to have an End element after each message action, that's okay! Your flow will still function as intended (and will pass the check for this unit). However, if you want to merge the branches so they converge into one End element, follow these steps. (Please note: this is optional and doesn't affect the functionality of the flow.) 

  1. Directly after the Message from Mars 1 element, click Add Element.
  2. Select Connect to element.
  3. Click Select element on the Message 2 path's End element.
  4. Repeat the process to connect the Message from Mars 3 element to the End element now shared by the Message 1 and Message 2 paths.

3, 2, 1… Activate!

Now, it’s time to activate the flow.

  1. Click Save.
  2. Click Activate.
  3. Click the Back in the upper left.
在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈