If your Approval Workflow requires a requester's manager to approve requests, but the manager is not a user in vCommander, you can use the solution offered in this article. This solution is suitable for single domain directories only.
Requirements
- Embotics vCommander 5.7.9 or later
- PowerShell v4 installed on the vCommander application server
- vCommander Script
- Remote Server Administration Tools OR Active Directory MMC snap-in installed on the vCommander application server
- vCommander Service Account has rights to query Active Directory
- vCommander application server must be on the domain
Preparing the Script
You should have already downloaded and extracted the script to your vCommander application server as detailed in the requirements section. Embotics recommends storing all scripts call by vCommander in a single location, using sub-folders to identify the functions of scripts. With the script used by this solution extracted to C: on the vCommander server, the file system will look like this:
- C:\scripts\lookup\GetManager.ps1
Configuring the Approval Workflow
Only the two required steps to look up and send an approval email to the requester's manager are covered here. Your Approval Workflow may contain additional steps.
- Under Configuration > Service Request Configuration > Approval Workflow click Add to create a new workflow or select the workflow to update and click Edit.
- On the Steps page, click Add > Execute Script and configure the step as follows:
Step Name: Lookup AD Manager
Step Execution: Always Execute
Timeout: 300 seconds
Script Output: Capture script output as comment
When Step Fails: Mark workflow step as failed: do not proceed
Command Line:powershell.exe -ExecutionPolicy Bypass "&{c:\scripts\lookup\GetManager.ps1 '#{request.requester.userid}'}"
Click Add > Send Approval Email and configure the step as follows:
Step Name: Email Manager
Step Execution: Always execute
Address List: #{steps[1].output}
Email Subject: Service request #{request.id}: Approval needed.
Email Body: Please review the following request details.
Note that the variable used in the Address List field must refer to the step number which ran the script. In this example, it was step 1.Complete the wizard as appropriate.