1"use strict";(self.webpackChunkembedded_workflow_builder_docs=self.webpackChunkembedded_workflow_builder_docs||[]).push([["7558"],{92038(e,n,t){t.r(n),t.d(n,{metadata:()=>s,default:()=>h,frontMatter:()=>o,contentTitle:()=>a,toc:()=>d,assets:()=>l});var s=JSON.parse('{"id":"building","title":"Building Workflows","description":"Build new Workflows using Acme Inc\'s Workflow Builder","source":"@site/docs/building.md","sourceDirName":".","slug":"/building","permalink":"/building","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"title":"Building Workflows","description":"Build new Workflows using Acme Inc\'s Workflow Builder"},"sidebar":"docs","previous":{"title":"Getting Started","permalink":"/get-started"},"next":{"title":"Branching","permalink":"/branching"}}'),r=t(74848),i=t(28453);let o={title:"Building Workflows",description:"Build new Workflows using Acme Inc's Workflow Builder"},a,l={},d=[{value:"Creating a new Workflow",id:"creating-a-new-workflow",level:2},{value:"Steps",id:"steps",level:2},{value:"The trigger step",id:"the-trigger-step",level:3},{value:"Adding steps to your Workflow",id:"adding-steps-to-your-workflow",level:3},{value:"Changing step names and descriptions",id:"changing-step-names-and-descriptions",level:3},{value:"Passing data between steps",id:"passing-data-between-steps",level:2},{value:"Step results",id:"step-results",level:3},{value:"The trigger's step result",id:"the-triggers-step-result",level:3},{value:"Step inputs",id:"step-inputs",level:3}];function c(e){let n={a:"a",code:"code",h2:"h2",h3:"h3",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.p,{children:"Acme Inc's Workflow Builder lets you build Workflows that connect Widget ERP to other applications and services you use.\nThis article describes how to build Workflows."}),"\n",(0,r.jsxs)(n.p,{children:["If you have not done so yet, please first review the ",(0,r.jsx)(n.a,{href:"/get-started",children:"Getting Started"})," guide."]}),"\n",(0,r.jsx)(n.h2,{id:"creating-a-new-workflow",children:"Creating a new Workflow"}),"\n",(0,r.jsxs)(n.p,{children:["To create a new Workflow, first log in to ",(0,r.jsx)(n.a,{href:"https://acme.com/login",children:"Widget ERP"}),".\nNext, navigate to integrations > workflows and click on 'manage workflows'.\nHere, you will see all of the Workflows that you've built."]}),"\n",(0,r.jsxs)(n.p,{children:["To create a new Workflow, click ",(0,r.jsx)(n.strong,{children:"+ Workflow"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"steps",children:"Steps"}),"\n",(0,r.jsxs)(n.p,{children:["Actions, like downloading a file from an ",(0,r.jsx)(n.a,{href:"/connectors/sftp",children:"SFTP server"})," or posting a message to ",(0,r.jsx)(n.a,{href:"/connectors/slack",children:"Slack"}),", are added as Workflow ",(0,r.jsx)(n.strong,{children:"steps"}),".\nSteps are executed in order, and results from one step can be used as inputs for subsequent steps."]}),"\n",(0,r.jsxs)(n.p,{children:["Steps are run in order from top to bottom, and you can add conditional logic to your Workflow with ",(0,r.jsx)(n.a,{href:"/branching",children:"branching"}),", or run a series of steps within a ",(0,r.jsx)(n.a,{href:"/looping",children:"loop"}),".\nIf one step throws an error, your Workflow stops running until it is invoked again (though you can decide how to ",(0,r.jsx)(n.a,{href:"/error-handling",children:"handle errors"}),")."]}),"\n",(0,r.jsx)(n.h3,{id:"the-trigger-step",children:"The trigger step"}),"\n",(0,r.jsxs)(n.p,{children:["The first step of your Workflow is the ",(0,r.jsx)(n.strong,{children:"trigger"})," step, which determines when your Workflow will run.\nThe ",(0,r.jsx)(n.a,{href:"/triggering",children:"triggers"})," article details how triggers work and how to invoke your Workflow."]}),"\n",(0,r.jsx)(n.h3,{id:"adding-steps-to-your-workflow",children:"Adding steps to your Workflow"}),"\n",(0,r.jsxs)(n.p,{children:["To add a step to your Workflow, click the ",(0,r.jsx)(n.strong,{children:"+"})," icon underneath the trigger or another action."]}),"\n",(0,r.jsxs)(n.p,{children:["Select the connector and action you would like to add to your Workflow.\nFor example, you can choose the ",(0,r.jsx)(n.strong,{children:"Amazon DynamoDB"})," connector, and then select the ",(0,r.jsx)(n.strong,{children:"Query Items"})," action."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Add a step to a Workflow",src:t(45791).A+"",width:"400",height:"579"})}),"\n",(0,r.jsx)(n.h3,{id:"changing-step-names-and-descriptions",children:"Changing step names and descriptions"}),"\n",(0,r.jsxs)(n.p,{children:["By default, steps are uniquely named after the action they invoke (so, they're named things like ",(0,r.jsx)(n.strong,{children:"CSV to JSON"})," or ",(0,r.jsx)(n.strong,{children:"Delete Object"}),").\nTo override that default name, select the step in the Workflow and then click the step's name in the configuration drawer."]}),"\n",(0,r.jsxs)(n.p,{children:["Like using descriptive variable names in a computer program, renaming steps allows you to give your steps descriptive names.\nRather than ",(0,r.jsx)(n.code,{children:"HTTP - PUT"}),", you could give your step a name like ",(0,r.jsx)(n.strong,{children:"Update Record in Acme"}),".\nWe recommend giving your steps descriptive names and descriptions so your team members can read through your Workflows and understand their purpose more readily."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Rename a step",src:t(94530).A+"",width:"300",height:"216"})}),"\n",(0,r.jsx)(n.h2,{id:"passing-data-between-steps",children:"Passing data between steps"}),"\n",(0,r.jsxs)(n.p,{children:["As your Workflow runs, each step generates a ",(0,r.jsx)(n.a,{href:"#step-results",children:"step result"}),".\nThe results of one step can be fed into subsequent steps through ",(0,r.jsx)(n.a,{href:"#step-inputs",children:"step inputs"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"step-results",children:"Step results"}),"\n",(0,r.jsxs)(n.p,{children:["Each step in your Workflow produces a result.\nFor example, an ",(0,r.jsx)(n.a,{href:"/connectors/sftp#listdirectory",children:"SFTP - List Directory"})," step will return a list of strings representing file names."]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"SFTP list directory result",src:t(6049).A+"",width:"800",height:"311"})}),"\n",(0,r.jsxs)(n.p,{children:["An ",(0,r.jsx)(n.a,{href:"/connectors/sftp#readfile",children:"SFTP - Read File"})," step will return the contents of a file that is pulled from an SFTP server (in this example, an image was fetched).\n",(0,r.jsx)(n.img,{alt:"SFTP list read file",src:t(87860).A+"",width:"800",height:"207"})]}),"\n",(0,r.jsx)(n.p,{children:"Step results take one of three forms:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["A primitive value, like a ",(0,r.jsx)(n.strong,{children:"string"}),", ",(0,r.jsx)(n.strong,{children:"boolean"})," (true/false), ",(0,r.jsx)(n.strong,{children:"number"}),", an ",(0,r.jsx)(n.strong,{children:"array"})," of primitives, or even a ",(0,r.jsx)(n.code,{children:"null"})," for steps that have nothing to return."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["A ",(0,r.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",children:"JavaScript Object"})," with several key-value pairs."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{ "key1": "value1", "key2": ["foo", "bar", "baz"] }\n'})}),"\n",(0,r.jsxs)(n.p,{children:['You can reference objects\' keys using "dot notation".\nFor example, to reference ',(0,r.jsx)(n.code,{children:'"baz"'})," above, a subsequent step could reference this step's ",(0,r.jsx)(n.code,{children:"results.key2.2"})," (note the ",(0,r.jsx)(n.code,{children:".2"}),' references "the item at index ',(0,r.jsx)(n.code,{children:"2"}),' in the list").']}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["A ",(0,r.jsx)(n.strong,{children:"binary file"}),".\nBinary file outputs are objects that contain a ",(0,r.jsx)(n.code,{children:"contentType"})," property (like ",(0,r.jsx)(n.code,{children:'"image/png"'}),") and a ",(0,r.jsx)(n.code,{children:"data"})," property containing the contents of the file in a ",(0,r.jsx)(n.a,{href:"https://nodejs.org/api/buffer.html",children:"JavaScript Buffer"}),"."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "data": Buffer,\n "contentType": "application/pdf"\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["When viewing a binary file that can be rendered in a browser (like an image), you'll see the image in the ",(0,r.jsx)(n.strong,{children:"Output"})," drawer.\nIf you've downloaded a different binary file type (like a PDF or MP3), you'll see it represented like ",(0,r.jsx)(n.code,{children:"data<123456 bytes>"}),"."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"the-triggers-step-result",children:"The trigger's step result"}),"\n",(0,r.jsx)(n.p,{children:"The trigger step's result contains two major things:"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["Metadata about the execution.\nFor example, your trigger's ",(0,r.jsx)(n.code,{children:"result.invokeUrl"})," contains the webhook URL for your Workflow.\nThe ",(0,r.jsx)(n.code,{children:"result.startedAt"})," property contains the time at which the execution began."]}),"\n",(0,r.jsxs)(n.li,{children:["The webhook request (if your Workflow was invoked via webhook), including:\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["HTTP headers. If your webhook request included custom HTTP headers, you can reference them from your trigger's ",(0,r.jsx)(n.code,{children:"result.headers.header-name"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["Request body. ",(0,r.jsx)(n.code,{children:"result.rawBody"})," contains the raw, unparsed body that was sent to your Workflow webhook URL. If you sent JSON data, the JSON will be parsed under ",(0,r.jsx)(n.code,{children:"result.body.data"}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Referencing trigger step result",src:t(912).A+"",width:"500",height:"807"})}),"\n",(0,r.jsx)(n.p,{children:"Other steps in your Workflow can reference both the metadata and webhook request data contained in your trigger's result."}),"\n",(0,r.jsx)(n.h3,{id:"step-inputs",children:"Step inputs"}),"\n",(0,r.jsxs)(n.p,{children:["Each step of your Workflow requires a set of ",(0,r.jsx)(n.strong,{children:"inputs"}),".\nAn input might represent a RESTful URL to fetch data from, an ID of a Salesforce Lead to update, the name of an Amazon S3 bucket, or the contents of a file to upload."]}),"\n",(0,r.jsx)(n.p,{children:"Some inputs are required, while others are optional."}),"\n",(0,r.jsx)(n.p,{children:"The inputs you specify can be static strings (like an Amazon S3 bucket name), a reference to a previous step's results (like a Salesforce Lead ID), or a combination of the two (like a RESTful URL that has dynamic portions)."}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Step inputs",src:t(69959).A+"",width:"500",height:"698"})})]})}function h(e={}){let{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},45791(e,n,t){t.d(n,{A:()=>s});let s=t.p+"assets/images/add-step-102c68d061a7918cd9c91ebc659c8d06.png"},94530(e,n,t){t.d(n,{A:()=>s});let s=t.p+"assets/images/rename-step-d5228848343f06c2bf681fefe27feae6.png"},6049(e,n,t){t.d(n,{A:()=>s});let s=t.p+"assets/images/sftp-list-directory-5e7fd455aa1dcce14d2371336edc40ea.png"},87860(e,n,t){t.d(n,{A:()=>s});let s=t.p+"assets/images/sftp-read-file-9a5cd7ffbcbb905d829aef851ea1287f.png"},69959(e,n,t){t.d(n,{A:()=>s});
1let s=t.p+"assets/images/step-inputs-53afeb723ff08c33349bed148bf3852d.png"},912(e,n,t){t.d(n,{A:()=>s});let s=t.p+"assets/images/trigger-step-result-b4458306b13445c630badc92f681947a.png"},28453(e,n,t){t.d(n,{R:()=>o,x:()=>a});var s=t(96540);let r={},i=s.createContext(r);function o(e){let n=s.useContext(i);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.