This walkthrough builds a small workflow, "Request an NDA", in both the visual editor and the code editor. It asks whether the NDA is one-way or mutual, creates the right document, and emails Legal.
Before opening the editor, write the steps down and mark where the process branches:
You'll need two templates, one for each NDA. See Building your first template.
The workflow opens in the visual editor.
In the visual editor, add actions from the action menu:
Connections decide what happens next. Connect from the question to each document action and choose Sometimes, setting the condition to the answer that leads there. Connect each document action to an email with Always.
An item can only have one "next" item at a time. If two branches should end with the same step, each branch needs its own copy of that step, or you can use a Blocker. See Routing with filters and outcomes.
Open the Code tab to see what the visual editor wrote. This is the complete workflow:
--#item:
---id:nda_type
---title:What kind of NDA do you need?
---action:question
---options:Is the NDA one-way or mutual?
---answer1|text:One-way
---answer2|text:Mutual
---filter1|filter:answer EQUALS One-way
---filter1|outcome:make_one_way
---filter2|filter:answer EQUALS Mutual
---filter2|outcome:make_mutual
--#item:
---depends_on:nda_type
---id:make_one_way
---alias:nda
---title:Your one-way NDA
---action:auto_document
---options:{one_way_template_key}
---stage:create
---pass_variables:counterparty_IS_{{counterparty_name}}
---outcome:email_legal_1
--#item:
---depends_on:nda_type
---id:make_mutual
---alias:nda
---title:Your mutual NDA
---action:auto_document
---options:{mutual_template_key}
---stage:create
---pass_variables:counterparty_IS_{{counterparty_name}}
---outcome:email_legal_2
--#item:
---depends_on:make_one_way
---id:email_legal_1
---action:auto_email
---to:legal@example.com
---subject:New NDA with {{counterparty_name}}
---body:A one-way NDA has been created.~~~{{document_url_base}}{{nda}}
--#item:
---depends_on:make_mutual
---id:email_legal_2
---action:auto_email
---to:legal@example.com
---subject:New NDA with {{counterparty_name}}
---body:A mutual NDA has been created.~~~{{document_url_base}}{{nda}}
Points to notice:
The workflow uses {{counterparty_name}}, so that value has to be collected when the task starts. Go to Settings → Extra fields and add a text field named counterparty_name. See Launch forms.
Start a task from your Workspace and work through it. Check each branch. If something doesn't appear when you expect it to, see Testing and troubleshooting.
When building a workflow for a user: