Salesforce Lightning Builder Flows (Salesforce Lightning 构建Flows)

本文构建Salesforce Lightning Flows 只是一个简单的实现步骤,原文地址如下:

  https://trailhead.salesforce.com/en/content/learn/modules/business_process_automation/flow

在开始之前我们得先知道几个概念:

  1. Lightning Flow:它是包含了构建、管理、运行流和流程的产品。
  2. Flow Builder:它是构建Flow的工具。
  3. Flow:通过收集数据并在Salesforce org或外部系统中执行某些操作来自动化业务流程的应用程序。

 注:then add a flow action to your process。

  • Flow 构建块

    每个Flow都由三个构建块组成。

    
    1. Elements:它显示在画布上。添加一个元素到画布,从工具栏单击或拖拽它。
    2. Connectors:定义flow在运行时的路径,它们告诉Flow接下来将做什么。
    3. Resources:是表示给定值的容器,如字段值或公式。您可以在整个流程中引用资源。例如,查找帐户的ID,将该ID存储在一个变量中,然后引用该ID来更新帐户。
  •  Flow 元素包含四种不同的类型
    1. Screen:向用户显示数据或从屏幕上收集用户输入的信息,可以在屏幕上添加简单的字段,像输入字段和单选按钮,以及out-of-the-box Lightning组件,如文件上传。

       

    2. Logic:控制Flow的数据Create,Update,循环结束设置数据。
    3. Actions:当您拥有必要的信息(可能通过屏幕从用户那里收集)时,在Salesforce中执行一些操作。Flow可以查找、创建、更新和删除Salesforce记录。他们还可以创建聊天帖子,提交记录以获得批准,并发送电子邮件。如果您的操作无法开箱即用,请从Flow中调用Apex代码。
    4. Integrations:通过使用核心操作或Apex操作将流连接到外部数据库。Core actions允许您在不经过Salesforce服务器的情况下发出请求。Flow Builder还与平台事件有一些关联。使用Create Records元素发布平台事件消息。使用Pause元素订阅平台事件。
  • Take a Tour(参考)

    1.Toolbox:它里面包含元素和资源。 

    2.Canvas:Flow构建是在可视化界面构建。

    3.Button Bar:按钮提供关于Flow的任何信息,例如:

      1、Flow是否被激活

      2、Flow保存了多长时间

      3、流是否有任何警告或错误。要查看警告或错误,请单击相应的图标

    4.Keyboard Shortcuts:使用这些快捷键来快速浏览Flow

      1、windows快捷键:

        放大,按Ctrl =。

        缩小,按Ctrl -。

        适应,按Ctrl 0。

        缩放以查看,按Ctrl 1。

        要平移,按住空格键,同时用鼠标拖动画布。

         要选择画布上的多个元素,请按住Shift键并单击每个元素。
      2、Mac 快捷键:  
        放大,按Ctrl =。

        缩小,按Ctrl -。

        适应,按Ctrl 0。

        缩放以查看,按Ctrl 1。
    •     要平移,按住空格键,同时用鼠标拖动画布。
       要选择画布上的多个元素,请按住Shift或Command并单击每个元素。
         
  • 构建Flow步骤
    1. 添加一个Screen来收集用户输入
      1. From the toolbox, drag a Screen element onto the canvas.
      2. Name it New Account in the Label field.
      3. In Screen Components, click Text and then click Text again.
      4. Select the first Text screen component and enter Account Name in the Label field.
      5. Select the second Text screen component and enter Phone Number in the Label field.
      6. Select the footer and on the right and under Control Navigation, deselect Previous and Pause.

         

      7. Click Done.
    2. 添加Create Record元素来创建记录  
      1. From the Toolbox, drag a Create Records element onto the canvas. Name it Create Account.
      2. For How to Set the Record Fields, select Use separate variables, resources, and literal values.
      3. In Create a Record of This Object, in Object, select Account.
      4. In Field, select Name.
      5. In Value, select SCREEN COMPONENTS | Account_Name.
      6. Click Add Field.
      7. In Field, select Phone.
      8. In Value, select SCREEN COMPONENTS | Phone_Number.
      9. In Store Account ID in Variable, select New Resource from the Variable dropdown. The New Resource window appears.
        1. In Resource Type, select Variable.
        2. Name the API Account_Id.
        3. In Data Type, select Text.
        4. Click Done.
      10. In Store Account ID in Variable, select VARIABLES | Account_Id from the Variable dropdown. Make sure that your Create Records element looks like this.

         

      11. Click Done.
       
    3. 创建能够上传文件的界面
      1. Drag another Screen element onto the canvas.
      2. In Screen Properties, configure these settings.
        1. Name the screen Upload Files in the Label field.
        2. Under Control Navigation, deselect Previous and Pause.
        3. If you don't make that selection users will be able to navigate back to the first screen, and multiple accounts could accidentally be created.
      3. On the left in Screen Components, click File Upload.
        1. For API Name, enter accountFiles.
        2. For File Upload Label, enter Upload Related Files.
        3. For Related Record ID, select VARIABLES | Account_Id.
        4. For Allow Multiple Files, select $GlobalConstant.True.

           

      4. Click Done.
    4. 连接元素以及完成流程
      1. Click the node at the bottom of Start and drag it to New Account.
      2. Click the node at the bottom of New Account and drag it to Create Account.
      3. Click the node at the bottom of Create Account and drag it to Upload Files.

         

      4. Save the flow, name it Quick Account in Flow Label, and set the type to Screen Flow.
      5. Click Save.
        Skip the warning you see about Lightning runtime. We talk about that next.
    5. 让你的Flows更像Lightning                 
      Salesforce提供了两种运行时体验,它们决定了某人在运行Flow的样子和感觉。让你的Flows融入到Lightning Experience,确保你在Lightning已启用了这个Flows。
      1. From Setup, enter Automation in the Quick Find box, and then select Process Automation Settings.
      2. Verify that Enable Lightning runtime for flows is selected.
      3. Save your changes.
    6. Distribute Your Flow (分配你的Flow)

      1. 将Flow分配给用户。
      2. 要了解更多关于Flow的分配,请参考Screen Flow Distribution模块。
    7. Activate Your Flow(激活你的Flow)
      1. From Setup, enter Flows in the Quick Find box, then select Flows.  
      2. Click Quick Account.
      3. Find the appropriate version of the flow, and select Activate in the Action column.
    8. Add Your Flow to the Home Page(添加你的Flow到Home Page中)
      1. Create a home page.
        1. From Setup, enter Builder in the Quick Find checkbox, and then select Lightning App Builder.
        2. Click New.
        3. Select Home Page and click Next.
        4. Give the page a name and click Next.
        5. Click CLONE SALESFORCE DEFAULT PAGE, select Home Page Default, and click Finish.
      2. Drag a Flow component to the top of the right column

         

      3. For Flow, select Quick Account.
      4. Save your changes and activate the page. Mark this page as the default home page and click Save.
      5. To see your flow in action, go to your Home page.
        1. Click Back to return to Setup.
        2. Click App Launcher icon, and under All Items, click Home.

           

      6. Make Sure Your Users Can Run the Flow
    •  

posted on 2019-03-12 15:57  Luiken  阅读(1644)  评论(0编辑  收藏  举报

导航