UCSD Get Submitter User Information

Version 5
    Task NameGet Submitter User Information
    Description
    Prerequisites
    1. Tested on 5.3.1
    CategoryWorkflow
    ComponentsvSphere 5.x
    User Inputs

    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.

     

    Many thanks go out to Wee Kuenn Leow.

     

    The Workflow:

     

    Screen Shot 2015-06-29 at 10.48.37 AM.png

     

    The Variables that get updated:

     

    Screen Shot 2015-06-29 at 10.54.06 AM.png

    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