
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
06-29-2015 10:51 AM - edited 03-01-2019 06:35 AM
Task Name | Get Submitter User Information |
Description | |
Prerequisites |
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs |
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- 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.
Many thanks go out to Wee Kuenn Leow.
The Workflow:
The Variables that get updated:
Jun 29, 2015 17:39:54 UTC userId admin
Jun 29, 2015 17:39:54 UTC firstName Orf
Jun 29, 2015 17:39:54 UTC lastName Gelbrich
Jun 29, 2015 17:39:54 UTC groupName null
Jun 29, 2015 17:39:54 UTC UserId=admin, Name=OrfGelbrich
Jun 29, 2015 17:39:59 UTC myEMAIL: ogelbric@cisco.com
Jun 29, 2015 17:39:59 UTC myNAME: OrfGelbrich
Jun 29, 2015 17:39:59 UTC myGROUPNAME: null
Jun 29, 2015 17:39:59 UTC myGROUPNAME01: undefined
Jun 29, 2015 17:39:59 UTC myGROUPID: 0
The Cloupia 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("SUBMITTER_LASTNAME", lastName);
ctxt.updateInput("SUBMITTER_GROUPNAME", groupName);
ctxt.updateInput("SUBMITTER_GROUPNAME01", groupName01);
ctxt.updateInput("SUBMITTER_GROUPID", groupId);
// addinfo
logger.addDebug("myEMAIL: " + email);
logger.addDebug("myNAME: " + firstName + lastName);
logger.addDebug("myGROUPNAME: " + groupName);
logger.addDebug("myGROUPNAME01: " + groupName01);
logger.addDebug("myGROUPID: " + groupId);
The Log Run:
Service Request ID: 5260
Workflow Inputs:
- SUBMITTER_EMAIL
- SUBMITTER_FIRSTNAME
- SUBMITTER_LASTNAME
- SUBMITTER_GROUPNAME
- SUBMITTER_GROUPNAME01
- SUBMITTER_GROUPID
Jun 29, 2015 17:39:40 UTC Request submitted
Jun 29, 2015 17:39:45 UTC Executing workflow item number 1
Jun 29, 2015 17:39:45 UTC Completed workflow item number 1, with status Completed
Jun 29, 2015 17:39:51 UTC Executing workflow item number 2
Jun 29, 2015 17:39:51 UTC Trigger context executeWorkFlowStep called
Jun 29, 2015 17:39:51 UTC Executing custom action Get Submitter Information (ExecuteCloupiaScript)
Jun 29, 2015 17:39:51 UTC Executing custom action Get Submitter Information (ExecuteCloupiaScript)
Jun 29, 2015 17:39:54 UTC Executing cloupia script: Get Submitter Info - modified for AD
Jun 29, 2015 17:39:54 UTC userId admin
Jun 29, 2015 17:39:54 UTC firstName Orf
Jun 29, 2015 17:39:54 UTC lastName Gelbrich
Jun 29, 2015 17:39:54 UTC groupName null
Jun 29, 2015 17:39:54 UTC UserId=admin, Name=OrfGelbrich
Jun 29, 2015 17:39:59 UTC myEMAIL: ogelbric@cisco.com
Jun 29, 2015 17:39:59 UTC myNAME: OrfGelbrich
Jun 29, 2015 17:39:59 UTC myGROUPNAME: null
Jun 29, 2015 17:39:59 UTC myGROUPNAME01: undefined
Jun 29, 2015 17:39:59 UTC myGROUPID: 0
Jun 29, 2015 17:39:59 UTC Completed cloupia script Get Submitter Info - modified for AD
Jun 29, 2015 17:39:59 UTC Task #1 (Get Submitter Information (ExecuteCloupiaScript)) completed successfully in 7 seconds
Jun 29, 2015 17:39:59 UTC Input/Output values for Task #1 (Get Submitter Information (ExecuteCloupiaScript)):
Jun 29, 2015 17:39:59 UTC [Local Input: Label = Get Submitter Info - modified for AD]
Jun 29, 2015 17:39:59 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
Jun 29, 2015 17:39:59 UTC [Local Input: Undo Script = ]
Jun 29, 2015 17:39:59 UTC Completed workflow item number 2, with status Completed
Jun 29, 2015 17:40:00 UTC Executing workflow item number 3
Jun 29, 2015 17:40:00 UTC Completed workflow item number 3, with status Completed