E-mail Template with Workflow User Input

Version 3

    Posted for Logesh Kandasamy. Thank you very much.

     

    This is an example on how to update an e-mail template with workflow input from the user.

     

    The below 2 part of the code snippets to be placed in the Body section of the Email template. Try like as below. Please let us know if any clarification.

     

    1. 1.     Place the below code before the HTML <head> tag element


    Unknown.jpeg


                Code snippet 1:

    <Cloupia:ReportScript>

    importPackage(com.cloupia.service.cIM.inframgr.customactions);

    </Cloupia:ReportScript>

     

     

    1. 2.     Place the below code snippet before the HTML Body tag Closure

     

    Unknown-1.jpeg

     

    Code snippet 2:

     

    if (def != null && def != "")

    {

    var inputs = CustomActionUtil.getWorkflowInputFieldDefinitions(def.getId());

    • out.println("<p>Workflow Name:</p>"+ def.getName());
    • out.println("<table class='c1' width=85% cellpadding=5 border=2 bgcolor='" + "#E3EFFE" + "'>");
    • out.println("<tr><th>Label</th><th>Name</th><th>Type</th></tr>");

    for (var i=0;i<inputs.size();i++){

    var inputDef = inputs.get(i);

    var desc = inputDef.getDescription();

    var label = inputDef.getLabel();

    var name = inputDef.getName();

    var type = inputDef.getType();

    • out.println("<tr><td>"+label +"</td><td>"+name+"</td><td>"+type+"</td></tr>");

    }

    • out.println("</table>");

    }

     

     

    Unknown-2.jpeg

     

     

    The following code snippet will result in below picture:

     

     

     

     

    if (def != null && def != "")

    {

    var inputs = CustomActionUtil.getWorkflowInputFieldDefinitions(def.getId());

      importPackage(com.cloupia.service.cIM.inframgr.customactions);

      var srId = request.getDataObject().getObjects().getServcieRequest() .getInputSetId();

      var ListOfWorkflowInputValue = CustomActionUtil.getWorkflowInputValues(srId);

     

    •   out.println("<p>Workflow Name:</p>"+ def.getName());
    •   out.println("<table class='c1' width=85% cellpadding=5 border=2 bgcolor='" + "#E3EFFE" + "'>");
    •   out.println("<tr><th>Label</th><th>Value</th><th>Name</th><th>Type</th></tr>");

    for (var i=0;i<inputs.size();i++){

    var inputDef = inputs.get(i);

    var desc = inputDef.getDescription();

    var label = inputDef.getLabel();

    var name = inputDef.getName();

    var type = inputDef.getType();

      var value = ListOfWorkflowInputValue.get(i).getInputFldValue();

    •   out.println("<tr><td>"+label +"</td><td>"+value +"</td><td>"+name+"</td><td>"+type+"</td></tr>");

    }

    •   out.println("</table>");

    }


    Screen Shot 2016-11-15 at 9.10.43 AM.png

    I combined version 1 and version 2 to result in version3. 


    And a big thank you to Tejeswar Sahu

     

    Attached is the version that prints this version:

     

    Screen Shot 2016-11-15 at 9.12.13 AM.png