Working with user interactions

This recipe will teach us how to create user interactions. User interactions are additional inputs that can be asked of users during the workflow execution.

Getting ready

We need to be able to create a new workflow.

For this recipe, you will need to have more than one AD/LDAP/SSO group configured to access Orchestrator. Remember that you can use the Orchestrator internal LDAP to test this. To facilitate this, please follow the recipe User management in Chapter 7, Interacting with Orchestrator.

For the example, in the There's more... section, we will also showcase the interaction with the vSphere Web Client.

How to do it...

We will split this recipe into two parts, the creation of the interaction workflow and the test run that will show how to answer the interaction.

Creating the workflow

  1. Create a new workflow with the following variables:

    Name

    Type

    Section

    Use

    Group

    LdapGroup

    IN

    This contains the group that is enabled to answer the interaction.

    userString

    String

    Attribute

    This is defined when the user answers the interaction.

    errorCode

    String

    Attribute

    This contains the error code.

    Date

    Date

    IN

    This is the date until the customer interactions waits for answers.

    inString

    String

    IN

    This is a string value that is defined when the workflow starts.

  2. Define for the group attribute an LDAP group that should be allowed to answer the interaction (if you don't have an LDAP/AD/SSO, you can use vcousers from the local Orchestrator LDAP).
  3. Drag a User interaction element onto the schema and edit it.
  4. The User interaction element looks different from the elements you have encountered before. The Attributes tab contains the security.group and timeout.date attributes, as well as arrays for users and groups. The security.group (or the arrays) attribute defines which users (or groups) are allowed to answer this user interaction. Bind this attribute to the group attribute. The timeout.date attribute defines when this user interaction expires. Bind the date in-parameter to it.

    Creating the workflow

  5. The External inputs tab defines what variables the user interaction asks for. You can add workflow attributes or out-parameters here. For our example, we just add the userString attribute:

    Creating the workflow

  6. The Presentation tab works the same way as the normal workflow presentation (see the recipe Workflow Presentations in Chapter 5, Visual Programming).

    Creating the workflow

  7. We will be building the following structure in the next steps:

    Creating the workflow

  8. Drag the System error element onto the User Interaction element and make sure that the bindings are correct (see the recipe Error handling in workflows in Chapter 5, Visual Programming).
  9. To make sure that something happens after the interaction, add Scriptable task to the schema (see the previous screenshot) and bind the inString and userString variables as an in-parameter to it. Also, bind the outString out-parameter as an out-parameter. In the scripting section, add outString=inString+UserString.
  10. We now need to make sure that the group that should answer the interaction actually is able to access the workflow. In the Permission tab of the workflow, add the group you have defined as the security group in step 4. The user group needs the Execute permission. Check the recipe User management in Chapter 7, Interacting with Orchestrator.
  11. Save and close the workflow.

Answering the user interaction

  1. Run the workflow you have just created.
  2. First, you are presented with the normal input request from the workflow. Enter an expiration date (maybe 15 minutes from now) and some text.
  3. If you are an Orchestrator admin, you will now be presented with the user interaction input. If this is the case, click on Cancel.
  4. Have a look at the workflow; you will notice that it is still running and is now waiting for a user input. Log in to a second Orchestrator Client as a member of the group you defined as the security group in step 10 of the previous section.
  5. Select the Run mode of the Orchestrator Client and click on the Waiting for Input tab. Here, you find all the workflows that are currently waiting for input.

    Answering the user interaction

  6. Click on the workflow and then on Answer a user interaction (the speech bubble icon).
  7. The input for the user interaction will now pop up. Enter a value for userString and click on Submit.
  8. Wait till the workflow has finished and then change back to the Orchestrator Client with the administrator login.
  9. Take a look at the finished workflow execution.

How it works...

User interactions are created so that a workflow can get additional input when it is already running. You can define variables (External inputs) as an input that a user should use, and you can format the input as you have already learned in the recipe Workflow presentations in Chapter 5, Visual Programming.

The security.assignee and security.assignee.groups fields are new in vRO 7. Please note that you can assign the security group or array input as NULL.

The important thing is that you can define a security group that is the recipient of this user request. This makes it possible that one group of Orchestrator users (for example, VM requesters) can start a workflow and have the workflow wait until a different group (VM approvers) has answered the user interaction.

The expiry date is also useful as it lets you define when a user action was not answered in a certain timeframe. If a user interaction was not answered, the User interaction element will generate an error with the Timeout on signal message. This makes it possible to create a follow-up action, for example, send an e-mail to the VM requester that his request has failed.

A workflow that is in the state of Waiting keeps this state, even if the Orchestrator server is powered off, as this information is stored in the Orchestrator database.

A common practice is to put the security group that is used into a configuration (see the recipe Working with configurations in Chapter 8, Better Workflows and Optimized Working).

There's more...

To use the vSphere Web Client to answer a user interaction, follow these steps:

  1. Log in to vSphere Web Client as a member of the group you defined as the security group in step 4 in this recipe (or as an Orchestrator admin).
  2. Click on vCenter Orchestrator and then on Waiting for interaction. (You might need to wait a moment for the Web Client to load the information.)
  3. You will see all currently waiting workflows. Mark the workflow and select Answer the workflow run (the blue person icon). A pop-up window will show you the user interaction:

    There's more...

Answering using vRealize Automation

When you start a workflow using vRealize Automation (vRA) and this workflow contains a user interaction element, the user can answer by navigating to Inbox | Manual User Action.

See also

See the example workflow 06.08 Working with User Interaction.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset