cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1686
Views
1
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameHow to create checkboxes for the end user and a way to create global variables
Description
  1. Change the user of a running workflow
Prerequisites
  1. Tested on 5.3.1
CategoryWorkflow
ComponentsvSphere 5.x
User Inputs
  1. userid to change to
Output

Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

A big thank you goes out to Abhilash Pujari for this inspiration:

This is an example on how to create checkboxes for the end user to choose from and how to create a global variable for many workflows to use.

Global Variable

     Create a custom variable LOV  (Policies -> Orchestration -> Custom Workflow Inputs)

Screen Shot 2015-07-28 at 8.13.27 AM.png

Screen Shot 2015-07-28 at 8.13.43 AM.png

Create a workflow with boolean inputs (resuts into a check box for the end user) and the global variable:

Screen Shot 2015-07-28 at 8.16.19 AM.png

Note here are that the Admin Input Value is selected for the Global variable!

Questions at workflow execution:

Screen Shot 2015-07-28 at 8.45.41 AM.png

The run log:

Service Request ID: 5422

Workflow Inputs:

- Linux

- Solaris

- Windows

- Global_Var1

Jul 28, 2015 13:33:35 UTC Request submitted

Jul 28, 2015 13:33:37 UTC Executing workflow item number 1

Jul 28, 2015 13:33:37 UTC Completed workflow item number 1, with status Completed

Jul 28, 2015 13:33:40 UTC Executing workflow item number 2

Jul 28, 2015 13:33:40 UTC Trigger context executeWorkFlowStep called

Jul 28, 2015 13:33:41 UTC Executing custom action CheckBoxandGlobalVaraibles (Get Submitter Information)

Jul 28, 2015 13:33:41 UTC Executing custom action CheckBoxandGlobalVaraibles (Get Submitter Information)

---- Jul 28, 2015 13:33:45 UTC Request submitted

Jul 28, 2015 13:33:45 UTC The child Service Request with srId 5423 created successfully

---- Jul 28, 2015 13:33:47 UTC Executing workflow item number 1

---- Jul 28, 2015 13:33:47 UTC Completed workflow item number 1, with status Completed

---- Jul 28, 2015 13:33:53 UTC Executing workflow item number 2

---- Jul 28, 2015 13:33:53 UTC Trigger context executeWorkFlowStep called

---- Jul 28, 2015 13:33:53 UTC Executing custom action Get Submitter Information (ExecuteCloupiaScript)

---- Jul 28, 2015 13:33:53 UTC Executing custom action Get Submitter Information (ExecuteCloupiaScript)

---- Jul 28, 2015 13:33:56 UTC Executing cloupia script: Get Submitter Info - modified for AD

---- Jul 28, 2015 13:33:56 UTC userId admin

---- Jul 28, 2015 13:33:56 UTC firstName Orf

---- Jul 28, 2015 13:33:56 UTC lastName Gelbrich

---- Jul 28, 2015 13:33:56 UTC groupName null

---- Jul 28, 2015 13:33:56 UTC UserId=admin, Name=OrfGelbrich

---- Jul 28, 2015 13:33:56 UTC myEMAIL: ogelbric@cisco.com

---- Jul 28, 2015 13:33:56 UTC myNAME: OrfGelbrich

---- Jul 28, 2015 13:33:56 UTC myGROUPNAME: null

---- Jul 28, 2015 13:33:56 UTC myGROUPNAME01: undefined

---- Jul 28, 2015 13:33:56 UTC myGROUPID: 0

---- Jul 28, 2015 13:33:56 UTC Completed cloupia script Get Submitter Info - modified for AD

---- Jul 28, 2015 13:33:56 UTC Task #1 (Get Submitter Information (ExecuteCloupiaScript)) completed successfully in 3 seconds

---- Jul 28, 2015 13:33:56 UTC Input/Output values for Task #1 (Get Submitter Information (ExecuteCloupiaScript)):

---- Jul 28, 2015 13:33:56 UTC [Local Input: Label = Get Submitter Info - modified for AD]

---- Jul 28, 2015 13:33:56 UTC [Local Input: Script = // Get Submitter Info importPackage(java.net); importPackage(java.lang); importPackage(java.util); importPackage(java.io); var userId = ctxt.getUserId(); // Get the current workflow submittes profile var userProfile = ctxt.getAPI().userAPIGetMyLoginProfile(); var firstName = userProfile.getFirstName(); var lastName = userProfile.getLastName(); var groupName = userProfile.getGroupName(); logger.addInfo('userId '+userId); logger.addInfo('firstName '+firstName); logger.addInfo('lastName '+lastName); logger.addInfo('groupName '+groupName); if ( groupName != null ) { var groupName01 = groupName.split('@')[0]; } var groupId = userProfile.getGroupId(); var role = userProfile.getRole(); var email = userProfile.getEmail(); // Add some debug statements into SR log logger.addDebug('UserId=' + userId + ', Name=' + firstName + lastName); // Save into workflow variables as needed ctxt.updateInput('SUBMITTER_EMAIL', email); ctxt.updateInput('SUBMITTER_FIRSTNAME', firstName); ctxt.updateInput('S

---- Jul 28, 2015 13:33:56 UTC [Local Input: Undo Script = ]

---- Jul 28, 2015 13:33:56 UTC Completed workflow item number 2, with status Completed

---- Jul 28, 2015 13:33:59 UTC Executing workflow item number 3

---- Jul 28, 2015 13:33:59 UTC Completed workflow item number 3, with status Completed

Jul 28, 2015 13:34:06 UTC Sub-workflow with SR-ID 5423 is complete

Jul 28, 2015 13:34:07 UTC Task #1 (CheckBoxandGlobalVaraibles (Get Submitter Information)) completed successfully in 26 seconds

Jul 28, 2015 13:34:07 UTC Input/Output values for Task #1 (CheckBoxandGlobalVaraibles (Get Submitter Information)):

Jul 28, 2015 13:34:07 UTC [Local Input: Workflow = Get Submitter Information]

Jul 28, 2015 13:34:07 UTC [Output: SUB_SR_ID = 5423]

Jul 28, 2015 13:34:07 UTC Completed workflow item number 2, with status Completed

Jul 28, 2015 13:34:09 UTC Executing workflow item number 3

Jul 28, 2015 13:34:09 UTC Trigger context executeWorkFlowStep called

Jul 28, 2015 13:34:09 UTC Executing custom action CheckBoxandGlobalVaraibles (Send Email)

Jul 28, 2015 13:34:09 UTC Executing custom action CheckBoxandGlobalVaraibles (Send Email)

Jul 28, 2015 13:34:13 UTC Sending email to ogelbric@cisco.com, with Subject 5422 Check box results and global varaible

Jul 28, 2015 13:34:14 UTC Task #2 (CheckBoxandGlobalVaraibles (Send Email)) completed successfully in 5 seconds

Jul 28, 2015 13:34:14 UTC Input/Output values for Task #2 (CheckBoxandGlobalVaraibles (Send Email)):

Jul 28, 2015 13:34:14 UTC [Template Input:E-mail Addresses = ${SUBMITTER_EMAIL}]

Jul 28, 2015 13:34:14 UTC [Resolved Template Input: E-mail Addresses = ogelbric@cisco.com]

Jul 28, 2015 13:34:14 UTC [Local Input: E-mail Addresses = ogelbric@cisco.com]

Jul 28, 2015 13:34:14 UTC [Template Input:Subject = ${SR_ID} Check box results and global varaible]

Jul 28, 2015 13:34:14 UTC [Resolved Template Input: Subject = 5422 Check box results and global varaible]

Jul 28, 2015 13:34:14 UTC [Local Input: Subject = 5422 Check box results and global varaible]

Jul 28, 2015 13:34:14 UTC [Template Input:Body = Linux Check Box Result : ${Linux} Solaris Check Box Result : ${Solaris} Windows Check Box Result : ${Windows} The Globald Variable Content: ${Global_Var1} ]

Jul 28, 2015 13:34:14 UTC [Resolved Template Input: Body = Linux Check Box Result : true Solaris Check Box Result : false Windows Check Box Result : true The Globald Variable Content: this_is_the_content_of_the_GLobal_Varaible ]

Jul 28, 2015 13:34:14 UTC [Local Input: Body = Linux Check Box Result : true Solaris Check Box Result : false Windows Check Box Result : true The Globald Variable Content: this_is_the_content_of_the_GLobal_Varaible ]

Jul 28, 2015 13:34:14 UTC [Output: EMAIL_ADDRESSES = ogelbric@cisco.com]

Jul 28, 2015 13:34:14 UTC Completed workflow item number 3, with status Completed

Jul 28, 2015 13:34:15 UTC Executing workflow item number 4

Jul 28, 2015 13:34:15 UTC Completed workflow item number 4, with status Completed

The resulting e-mail:

Screen Shot 2015-07-28 at 8.44.54 AM.png

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links