Links

102 - Building a Basic Workflow

Sign up for our LIVE training sessions below!

Rewst 102 Hands-on Exercises

Follow these steps to build the Add or Remove Users from AD workflow!
Step 1: Build a Form to Add or Remove Users in AD
Add a Form
  1. 1.
    Go to AutomationsForms in the menu.
  2. 2.
    Click Add at the top right to add a new Form.
  3. 3.
    Type Add or Remove from AzureAD Group for the name.
  4. 4.
    Click Submit.
Add a Dropdown field to Choose a User
  1. 1.
    Drag and Drop a Dropdown field.
  2. 2.
    Click on the field to open the field settings.
  3. 3.
    Type "user_id" for the Field Name.
  4. 4.
    Replace the default Field Label text with "User".
  5. 5.
    Type "Choose a User" for the Field Description text.
  6. 6.
    Click the Required checkbox.
  7. 7.
    Click on the Dynamic Options slider.
  8. 8.
    Choose Microsoft Graph for the Integration dropdown.
  9. 9.
    Choose Users for the Resource dropdown.
Add a Dropdown field to Choose a Group
  1. 1.
    Drag and Drop a Dropdown field.
  2. 2.
    Click on the field to open the field settings.
  3. 3.
    Type "group_id" for the Field Name.
  4. 4.
    Replace the default Field Label text with "Group".
  5. 5.
    Type "Select a Group" for the Field Description text.
  6. 6.
    Click the Required checkbox.
  7. 7.
    Click on the Dynamic Options slider.
  8. 8.
    Choose Microsoft Graph for the Integration dropdown.
  9. 9.
    Choose Groups for the Resource dropdown.
Add Radio Buttons to identify whether to add or remove users
  1. 1.
    Drag and Drop a Radio Buttons field.
  2. 2.
    Click on the field to open the field settings.
  3. 3.
    Type "action" for the Field Name.
  4. 4.
    Replace the default Field Label text with "Add or Remove".
  5. 5.
    Click the Required checkbox.
  6. 6.
    Type "Add" for the first Option Label.
  7. 7.
    Type "Remove" for the second Option Label.
  8. 8.
    Click on the minus (-) button to remove the third option.
  9. 9.
    Type "add" for the first Option Value.
  10. 10.
    Type "remove" for the second Option Value.
Save the form
  1. 1.
    Click the Save button at the top right of the form builder.
  2. 2.
    Click Submit on the pop-up to confirm.
Step 2: Build a Workflow to Add or Remove Users in AD
Create a New Workflow
  1. 1.
    Go to AutomationsWorkflows in the menu.
  2. 2.
    Click Create at the top right to add a new Workflow.
  3. 3.
    Type Add or Remove User from AzureAD Group for the name.
  4. 4.
    Click Submit.
Add the Initial Workflow Actions
  1. 1.
    Open the Microsoft Graph section in the left Actions menu.
  2. 2.
    Drag and Drop the Add Group Member action to the Workflow Canvas.
  3. 3.
    Open the Core section in the left Actions menu.
  4. 4.
    Drag and Drop the noop action to the Workflow Canvas.
  5. 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 Workflow Variable Inputs with the Form Variables
  1. 1.
    Click on the Configure Workflow Variable button in the top right menu.
    • This is the pencil icon.
  2. 2.
    Type "300" in the Time Saved (seconds) field.
  3. 3.
    Click the plus (+) button next to Input Configuration to add the user variable.
  4. 4.
    Type "user_id" in the name field.
  5. 5.
    Click the Required checkbox.
  6. 6.
    Click the plus (+) button next to Input Configuration again to add the group variable.
  7. 7.
    Type "group_id" in the name field.
  8. 8.
    Click the Required checkbox.
  9. 9.
    Click the plus (+) button next to Input Configuration again to add the action variable.
  10. 10.
    Type "action" in the name field.
  11. 11.
    Click the Required checkbox.
  12. 12.
    Click Submit.
Add Basic Configuration the Add Group Member Action
  1. 1.
    Click the Add Group Member Action.
  2. 2.
    Type "Adding user to Group" in the Description field.
  3. 3.
    Click on the Jinja editor button next to the Group field.
  4. 4.
    Type the following to to reference the group_id input variable with Jinja:
{{ CTX.group_id }}
  1. 5.
    Click on the Jinja editor button next to the User ID field.
  2. 6.
    Type the following to to reference the user_id input variable with Jinja:
{{ CTX.user_id }}
Add and Configure the Remove Group Member Action
  1. 1.
    Open the Microsoft Graph section in the left Actions menu.
  2. 2.
    Drag and Drop the Remove Group Member action to the Workflow Canvas.
  3. 3.
    Click the Remove Group Member Action.
  4. 4.
    Type "Removing user from Group" in the Description field.
  5. 5.
    Click on the Jinja editor button next to the Group field.
  6. 6.
    Type the following to to reference the group_id input variable with Jinja:
{{ CTX.group_id }}
  1. 7.
    Close the editor.
  2. 8.
    Click on the Jinja editor button next to the User ID field.
  3. 9.
    Type the following to to reference the user_id input variable with Jinja:
{{ CTX.user_id }}
  1. 10.
    Close the editor.
Configure the Noop action and add a second Transition
  1. 1.
    Click the Add (+) button on the noop action to add a new transition.
  2. 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.
  3. 3.
    Click on the noop Action to open the properties.
  4. 4.
    Click the edit icon next to the noop name.
  5. 5.
    Type "add_or_remove" for the name.
  6. 6.
    Type "Checks the action variable to determine if we are adding or removing a user from a group" for the Description.
Configure the Add Transition
  1. 1.
    Click on the left transition on the noop Action.
  2. 2.
    Type "Add" in the Custom Label field.
  3. 3.
    Click on the Custom Condition option under Condition.
  4. 4.
    Click on the Jinja editor button next to the Custom Condition field.
  5. 5.
    Type the following to add a custom condition where the action is performed on "add".
{{ CTX.action == "add" }}
  1. 6.
    Close the editor.
Configure the Remove Transition
  1. 1.
    Click on the right transition on the noop Action.
  2. 2.
    Type "Remove" in the Custom Label field.
  3. 3.
    Click on the Custom Condition option under Condition.
  4. 4.
    Click on the Jinja editor button next to the Custom Condition field.
  5. 5.
    Type the following to add a custom condition where the action is performed on "add".
{{ CTX.action == "remove" }}
  1. 6.
    Close the editor.
Set the Transitions to Follow First
  1. 1.
    Click the noop Action, now named "add_or_remove".
  2. 2.
    Click on the Advanced section at the bottom.
  3. 3.
    Click Follow First under Transition Mode.
  4. 4.
    Click Publish to save the Workflow.
Step 3: Triggering the Workflow with the Form
Add a Form Trigger
  1. 1.
    Click the Add Trigger button at the top menu.
  2. 2.
    Type "Form Trigger" in the Name field.
  3. 3.
    Click the Enabled slider.
  4. 4.
    Choose Core - Form Submission for the Trigger Type.
  5. 5.
    Choose Microsoft Graph for Integration Overrides.
  6. 6.
    Choose the Add or Remove User from AzureAD Group form under Trigger ParametersForm.
  7. 7.
    Click Submit.
  8. 8.
    Click Publish to save the Workflow with the new Trigger.
View the Form URL
  1. 1.
    Click Edit Trigger at the top menu next to our Form Trigger
  2. 2.
    Click the View Direct URLs button next to Dynamic Form URL.
  3. 3.
    Click on the link.
Test the Form
  1. 1.
    Choose a User.
  2. 2.
    Choose a Group.
  3. 3.
    Click Add or Remove.
⚠️ 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.
Step 4: Check the Results
View the Results of the Workflow
  1. 1.
    Go to view results for workflow.
    • This can be found next to the name of the workflow in the top menu.
  2. 2.
    Click on Succeeded under Status to see the full results.
📝Troubleshooting 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.

Get Credit

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

Additional Resources

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