07-28-2015 06:39 AM - edited 03-01-2019 06:36 AM
Task Name | How to create checkboxes for the end user and a way to create global variables |
Description |
|
Prerequisites |
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs |
|
Output |
Instructions for Regular Workflow Use:
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)
Create a workflow with boolean inputs (resuts into a check box for the end user) and the global variable:
Note here are that the Admin Input Value is selected for the Global variable!
Questions at workflow execution:
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:
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: