UCSD - Check for SR ID Status (Cancel Request)

Version 1
    Task Name

    Check the SR ID for status and cancel request

    Description

     

    Prerequisites
    1. Tested on 5.4
    CategoryWorkflow
    ComponentsvSphere 5.x
    User Inputse-mail address
    Outpute-mail with counter

    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 .WFDX file resides. Choose the .WFDX 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 thank you goes out to Mike Zimmerman

     

     

    The workflow:

     

    Screen Shot 2015-11-16 at 2.41.37 PM.png

     

    Workflow input for cancel:

     

    Screen Shot 2015-11-16 at 2.40.05 PM.png

     

    Workflow run:

     

    Screen Shot 2015-11-16 at 2.40.37 PM.png

     

    Workflow input for complete:

     

    Screen Shot 2015-11-16 at 2.41.30 PM.png

     

    Workflow run:

     

    Screen Shot 2015-11-16 at 2.41.16 PM.png

     

    The custom code:

     

     

    importPackage(java.lang);

     

    importPackage(java.util);

    importPackage(com.cloupia.lib.util.managedreports);

    function getReport(reportContext, reportName) {

    var report = null;

    try {

          report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);

    } catch(e) {

    }

        if (report == null) {

        return ctxt.getAPI().getTabularReport(reportName, reportContext);

        } else {

    var source = report.getSourceReport();

    return ctxt.getAPI().getTabularReport(source, reportContext);

        }

    }

    function getReportView(reportContext, reportName) {

    var report = getReport(reportContext, reportName);

        if (report == null)

    {

    logger.addError("No such report exists for the specified context "+reportName);

    return null;

    }

    return new TableView(report);

    }

    var reportName = "ServiceRequestFeature.group.table_config";

    var repContext = util.createContext("6", null, null);

    var report = getReportView(repContext, reportName);

    //"report" variable holds an array of table rows from the Service Requests tabular report in UCSD//

    //Use the following filters if you want to grab specific data...here I'm getting the row where "Service Request ID" equals "333" as an example...

    var results = report.filterRowsByColumn("Service Request Id", "333", false);

    //Once you have the row you want, you can request a specific column value....here I'm requesting the value in column "Request Status" for the first row (designated by the "0")

    var status = results.getColumnValue(0, "Request Status");

    //print status to logger...

    logger.addInfo("Status equals: "+status);