Adding the Record Lookup element to a Flow

The Record Lookup element allows you to search a record in Salesforce and save the field's value in variables. Now we will add a Record Lookup element to this Flow with these instructions:

  1. Navigate to the Palette tab and drag and drop the Record Lookup element onto the canvas; this will open a new window, where you have to enter following details:
    • Name: Enter the name for the Record Lookup element. In this case, enter Search for TextPosts as Name.
    • Unique Name: This will be autopopulated based on the name.
    • Description: Write some meaningful text so that another developer/administrator can easily understand why this Record Lookup element was created. When you select the Record Lookup element in the Explorer tab, the description appears in the Description pane.
    • Look up: Select the object you want to search the record of. In this case, select the CollaborationGroupFeed object. The next task is to define the search criteria. If you want to add multiple fields for the search criteria, then click on the Add Row link to add a new row. You can refer to the upcoming screenshot to define the search criteria.
    • Assign the record's field value to variables: Optionally, you can save the field's values into variables so that you can use them later in the Flow. Let's create a Text variable with the name VarTGroupFeed by expanding the CREATE NEW section of the drop-down list and set Input/Output Type as Input and Output; for Default Value, use {!$GlobalConstant.EmptyString}.

Don't forget to select the Assign null values to the variable(s) if no records are found checkbox, as shown in the following screenshot:

  1. Once you are done, click on the OK button.
  2. Now we will add the Decision element to evaluate the variable VarTGroupFeed. Drag and drop the Decision element onto the Flow canvas. Enter Name as Decide the next step and Unique Name will autopopulate based on Name. Optionally, you can also add Description for the Decision element. Then, create two outcomes for the Decision element, which are as follows:
    • Not Found: Select the VarTGroupFeed variable with the is null operator and the {!$GlobalConstant.True} value.
    • Found: Enter the name Found as DEFAULT OUTCOME.

This is shown in the following screenshot:

  1. Once you are done, click on the OK button.
  2. The next step is to add a Screen element with the name Display Message onto the canvas in order to display messages when no textpost is found. Add Display Text to the screen and configure the message, as shown in the following screenshot:
  3. You can switch to the Rich Text editor to add color and HTML code; for more details, refer to the Hands on 2 - real estate commission calculator section of Chapter 2, Creating Flow through Point and Click
  4. Once you are done, click on the OK button.
  5. Use the connector to connect the Screen, Record Lookup, Decision, and Record Delete elements; set the Screen element Delete Feeds as the starting point, as shown in the following screenshot:
  1. Save the Flow and close the Flow Designer using the Close button; this will redirect you to the Flow Detail page. Don't forget to activate the Flow version 2.
  2. To test it, navigate to the Home page and click on the Home custom link that we added to Clean Chatter Group Feeds; refer to step 4 of the Hands on 5 - adding Flow to the home page layout section for more details. If the Flow is unable to find any textpost, it will display the following message:

You can also use an image with Display Text; to do this, switch to the normal editor and use the HTML code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.47.203