102 - Building a Basic Workflow

Introduction

Hello and welcome! In this tutorial, we'll guide you through the process of creating automated workflows using Rewst. Our focus will be on creating a form, building an MVP workflow, and connecting the two with a trigger. Follow these steps to build the Add or Remove Users from AD workflow!

When you've completed this training, don't forget to get credit!

Watch the video and follow along with the steps below

Get Credit

To get credit for completing this session offline, please submit this form.

Follow Along

Part 1: Build a Form to Add or Remove Users in AD

We'll start by creating a form to collect the necessary information to pass to the workflow. First, we'll go to the Forms section in Rewst. Next, we'll design the form with fields, and configure the fields to dynamically show us a list of users and groups. And finally, we'll define which variables can be accessed from the workflow for each field. Follow these steps:

Steps: Building a Form

Add a Form

  1. Go to Automations β†’ Forms in the menu.

  2. Click Add at the top right to add a new Form.

  3. Type Add or Remove from AzureAD Group for the name.

  4. Click Submit.

Add a Dropdown field to Choose a User

  1. Drag and Drop a Dropdown field.

  2. Click on the field to open the field settings.

  3. Type "user_id" for the Field Name.

  4. Replace the default Field Label text with "User".

  5. Type "Choose a User" for the Field Description text.

  6. Click the Required checkbox.

  7. Click on the Dynamic Options slider.

  8. Choose Microsoft Graph for the Integration dropdown.

  9. Choose Users for the Resource dropdown.

Add a Dropdown field to Choose a Group

  1. Drag and Drop a Dropdown field.

  2. Click on the field to open the field settings.

  3. Type "group_id" for the Field Name.

  4. Replace the default Field Label text with "Group".

  5. Type "Select a Group" for the Field Description text.

  6. Click the Required checkbox.

  7. Click on the Dynamic Options slider.

  8. Choose Microsoft Graph for the Integration dropdown.

  9. Choose Groups for the Resource dropdown.

Add Radio Buttons to identify whether to add or remove users

  1. Drag and Drop a Radio Buttons field.

  2. Click on the field to open the field settings.

  3. Type "action" for the Field Name.

  4. Replace the default Field Label text with "Add or Remove".

  5. Click the Required checkbox.

  6. Type "Add" for the first Option Label.

  7. Type "Remove" for the second Option Label.

  8. Click on the minus (-) button to remove the third option.

  9. Type "add" for the first Option Value.

  10. Type "remove" for the second Option Value.

Save the form

  1. Click the Save button at the top right of the form builder.

  2. Click Submit on the pop-up to confirm.


Part 2: Build a Workflow to Add or Remove Users in AD

Next, let's design a workflow that responds to the form submissions. We'll start by going to the Workflow section in Rewst and adding a new workflow. Then, we'll add the actions, including MS Graph actions, to the workflow. Finally, we'll implement transitions based on whether a user is added or removed from a group.

Steps: Creating a Workflow

Create a New Workflow

  1. Go to Automations β†’ Workflows in the menu.

  2. Click Create at the top right to add a new Workflow.

  3. Type Add or Remove User from AzureAD Group for the name.

  4. Click Submit.

Add the Initial Workflow Actions

  1. Open the Core section in the left Actions menu.

  2. Drag and Drop the noop action to the Workflow Canvas.

  3. Open the Microsoft Graph section in the left Actions menu.

  4. Drag and Drop the Add Group Member action to the Workflow Canvas.

  5. Click and Drag the transition from the noop action to the Add Group Member action.

    • To do this, you will need to hover over the gray circle under the On Success section of the noop action.

Configure the Noop

  1. Click on the noop Action to open the properties.

  2. Click the edit icon next to the noop name.

  3. Type "add_or_remove" for the name.

  4. Type "Checks the action variable to determine if we are adding or removing a user from a group" for the Description.

Configure the Transition

  1. Click on the transition on the noop Action.

  2. Type "Add" in the Custom Label field.

  3. Click on the Custom Condition option under Condition.

  4. Click on the Jinja editor button next to the Custom Condition field.

  5. Type the following to add a custom condition where the action is performed on "add".

{{ CTX.action == "add" }}
  1. Close the editor.

Configure the Workflow Variable Inputs with the Form Variables

  1. Click on the Configure Workflow Variable button in the top right menu.

    • This is the pencil icon.

  2. Type "300" in the Time Saved (seconds) field.

  3. Click the plus (+) button next to Input Configuration to add the user variable.

  4. Type "user_id" in the name field.

  5. Click the Required checkbox.

  6. Click the plus (+) button next to Input Configuration again to add the group variable.

  7. Type "group_id" in the name field.

  8. Click the Required checkbox.

  9. Click the plus (+) button next to Input Configuration again to add the action variable.

  10. Type "action" in the name field.

  11. Click the Required checkbox.

  12. Click Submit.


Part 3: Triggering the Workflow with the Form

Next, we'll add a Form trigger to the workflow to ensure that the information that comes through the form can kick off the workflow process.

Steps: Triggering the Workflow with the Form

Add a Form Trigger

  1. Click the Add Trigger button at the top menu.

  2. Type "Form Trigger" in the Name field.

  3. Click the Enabled slider.

  4. Choose Core - Form Submission for the Trigger Type.

  5. Choose Microsoft Graph for Integration Overrides.

  6. Choose the Add or Remove User from AzureAD Group form under Trigger Parameters β†’ Form.

  7. Click Submit.

  8. Click Publish to save the Workflow with the new Trigger.


Part 4: Configuring the Add and Remove Graph Actions

We jumped ahead to show how to trigger a workflow with a form. We now are going back to set the parameters needed for the actions to add or remove a user from a group.

Steps: Finishing the Workflow

Add a Second Transition

  1. Click the Add (+) button on the noop action to add a new transition.

  2. Click and Drag the transition from the noop action to the Remove Group Member action.

    • To do this, you will need to hover over the gray circle under the new On Success section you added.

Configure the Remove Transition

  1. Click on the right transition on the noop Action.

  2. Type "Remove" in the Custom Label field.

  3. Click on the Custom Condition option under Condition.

  4. Click on the Jinja editor button next to the Custom Condition field.

  5. Type the following to add a custom condition.

{{ CTX.action == "remove" }}
  1. Close the editor.

Set the Transitions to Follow First

  1. Click the noop Action, now named "add_or_remove".

  2. Click on the Advanced section at the bottom.

  3. Click Follow First under Transition Mode.

  4. Click Publish to save the Workflow.

Add and Configure the Remove Group Member Action

  1. Open the Microsoft Graph section in the left Actions menu.

  2. Drag and Drop the Remove Group Member action to the Workflow Canvas.

  3. Click the Remove Group Member Action.

  4. Type "Removing user from Group" in the Description field.

  5. Click on the Jinja editor button next to the Group field.

  6. Type the following to to reference the group_id input variable with Jinja:

{{ CTX.group_id }}
  1. Close the editor.

  2. Click on the Jinja editor button next to the User ID field.

  3. Type the following to to reference the user_id input variable with Jinja:

{{ CTX.user_id }}
  1. Close the editor.

Configure Add Group Member Action

  1. Click the Add Group Member Action.

  2. Type "Adding user to Group" in the Description field.

  3. Click on the Jinja editor button next to the Group field.

  4. Type the following to to reference the group_id input variable with Jinja:

{{ CTX.group_id }}
  1. Click on the Jinja editor button next to the User ID field.

  2. Type the following to to reference the user_id input variable with Jinja:

{{ CTX.user_id }}

Part 5: Check the Results

Finally, let's test out the workflow by filling out the form and checking the workflow results!

Steps: Testing the Workflow

⚠️ This will only work with live data If you are using Microsoft Graph, make sure you keep in mind that this will work with live data so you can add or remove users appropriately. It's best to have pretend data to work with.

View the Form URL

  1. Click Edit Trigger at the top menu next to our Form Trigger

  2. Click the View Direct URLs button next to Dynamic Form URL.

  3. Click on the link.

Test the Form

  1. Choose a User.

  2. Choose a Group.

  3. Click Add or Remove.

View the Results of the Workflow

  1. Go to view results for workflow.

    • This can be found next to the name of the workflow in the top menu.

  2. Click on Succeeded under Status to see the full results.

πŸ“ If the user or group aren't valid, you may see failure. To troubleshoot, you can open the Context, Logs, or Input sections to dig into more detail and see what happened.


Conclusion

Congratulations! You have successfully created a form, designed a workflow, and connected the two with a trigger to automate Azure AD group management. In Rewst 103, we'll take a step back and look at using Jinja in our workflows. If you have any questions, don't hesitate to reach out. Happy automating!

Additional Resources

For more information on using Forms, Workflows, and Triggers, check out our documentation:

Need more guidance?

Sign up for our LIVE training sessions below!

Last updated