TMACUL

http://www.servicedeskusers.com/Add_Workflow_to_Employee/Customer_Interface

Blog Post created by TMACUL Champion on Jan 1, 2016

Overview

This article provides instructions for adding workflow capabilities to the Employee/Customer Interface. Workflow refers to the built-in classic legacy workflow, not the CA Workflow application that is included with the Service Desk installation.

Procedures

Step 1. Set Access Type

In order to be able to complete a Workflow Task, the Employee/Customer Access Types will need to be updated. The Functional Access for Change Orders must be changed to Modify.

Step 2. Add Nodes to Employee/Customer Scoreboards

Customize the Employee/Customer Scoreboard by adding a Node with the following parameters
Node label: pending tasks
Node's Stored Query: My Pending Tasks

Note: The My pending Tasks query is the default label for a query with the code of MYPEND which contains the syntax of...

assignee = @cnt.id AND status = \'PEND\' 

Step 3. Create list_wf.htmpl Form

The list_wf.htmpl form is needed if workflow nodes are added to the Employee/Customer Scoreboards. From this list, all of the workflow tasks meeting the criteria of the Stored Query associated with the node will be displayed. These are typically all the tasks assigned to the logged in person.

Click Here to download files, or copy syntax below.

<html lang="en"><HEAD>

<PDM_PRAGMA RELEASE=110>

<PDM_INCLUDE FILE="std_head.htmpl">

<SCRIPT>

var argBackfillField = '$args.KEEP.backfill_field';

var argBackfillForm = '$args.KEEP.backfill_form';

var argSearchSqlClause = '<PDM_FMT PAD=NO ESC_STYLE=C>$args.search_sql_clause</PDM_FMT>';

var argSearchWhereClause = '<PDM_FMT PAD=NO ESC_STYLE=C>$args.search_where_clause</PDM_FMT>';

var argSaveSqlClause = '<PDM_FMT PAD=NO ESC_STYLE=C>$args.KEEP.save_sql_clause</PDM_FMT>';

<PDM_IF "${current:n/a}" == "n/a">

var searchFilterInitialState = "show";

<PDM_ELSE>

var cfgCurrent = '$current';

var cfgTotal = '$total';

var cfgRecordCount = '$record_count';

var cfgStart = '$start';

var cfgLength = '$length';

</PDM_IF>

var cfgUseTemplate = '$args.use_template';

var cfgIsPopup = '$args.KEEP.IsPopUp';

var rptName = new Array("no", "no");

var cfgCanEdit = true;

</SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/date_helper.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/convert_date.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/val_type.js"></SCRIPT>

<PDM_INCLUDE FILE=std_list_include.htmpl>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/comboname.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/sitemods.js"></SCRIPT>

</HEAD>

<BODY CLASS="emp">

<PDM_INCLUDE FILE=std_body.htmpl>

<PDM_FORM NAME="frmFID">

</PDM_FORM>

<PDM_IF "${current:n/a}" != "n/a">

<SCRIPT LANGUAGE="JavaScript">

var msgFoundNone = "No workflow tasks found";

var msgFound1 = "1 workflow task found";

var msgFound = "%1 workflow tasks found";

var msgFoundMore = "%1 workflow tasks found. Displaying %2 through %3";

var msgSelect = "Click to select desired workflow task";

var ref_num_style;

<pdm_macro name=lsStart>

rs.overrideMenu=true;

<pdm_macro name=lsCol hdr="Task" attr=task link=yes>

<pdm_macro name=lsCol hdr="Assignee" attr=assignee>

<pdm_macro name=lsCol hdr="Status" attr=status>

<pdm_macro name=lsCol hdr="Description" attr=description  width=200>

<pdm_macro name=lsEnd factory=wf>

</SCRIPT>

</PDM_IF>

<BASE TARGET="_top">

<PDM_INCLUDE FILE="std_footer.htmpl">

</BODY>

</HTML>


Step 4. Create detail_wf.htmpl Form

The detail_wf.htmpl form will be accessed directly from an email URL or from the list_wf.htmpl. Sections have been added to allow for viewing details of the Change Order as well as viewing any Attachments on the Change Order. Both of these sections can be easily removed.

Click Here to download files, or copy syntax below.


<html lang="en"><HEAD>

<PDM_PRAGMA RELEASE=110>

<PDM_INCLUDE FILE=styles.htmpl>

<SCRIPT LANGUAGE="JavaScript">

var hdrTitle = "Change Workflow Detail";

var hdrTitleUpd = "Update Change Workflow";

var hdrTitleNew = "Create New Change Workflow";

</SCRIPT>

<PDM_INCLUDE FILE=std_head.htmpl >

<SCRIPT>

cfgDateFormat = "$date_format"

</SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/detail_form.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/arrow_button.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/check_submit.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/img_link.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/val_type.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/sitemods.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/attevts.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/convert_date.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/attmnt_upload.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" SRC="$CAisd/scripts/upload.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

<PDM_IF "$prop.form_name_3" == "ro">

var cfgAllowPopupResize = true;

var lnkid = -1;

var attdata = new Array();

</PDM_IF>

argPersistentID = "$args.persistent_id";

function unloadActions()

{

  if ( _dtl.edit )

  unload_check();

}

</SCRIPT>

</HEAD>

<BODY class=detailro onUnload="unloadActions()">

</SCRIPT>

<PDM_INCLUDE FILE=std_body.htmpl filename="Change Workflow">

<CENTER>

 

<INPUT TYPE=hidden NAME=FACTORY VALUE=wf>

<PDM_IF "$prop.form_name_3" == "edit">

<INPUT TYPE=hidden NAME=OP VALUE="UPDATE">

<PDM_IF 0 == $args.id>

<SPAN class=labeltext>You are not allowed to create a new Workflow</SPAN>

<PDM_ELSE>

<PDM_IF $args.id>

<INPUT TYPE=hidden NAME=SET.id  VALUE="$args.id">

</PDM_IF>

</PDM_IF>

</PDM_IF>

 

<SCRIPT LANGUAGE="JavaScript">

<PDM_MACRO NAME=dtlForm factory=wf button=false>

<PDM_IF "$prop.form_name_3" == "edit">

ImgBtnRow();

ImgBtnCreate("btn001", msgtext(208), "detailSave()", true, 120);

ImgBtnCreate("btncncl", msgtext(209), "cancel_update('$prop.form_name_2','$args.id','$args.NEXT_PERSID')", true, 120);

ImgBtnCreate("btn003", msgtext(400), "pdm_reset()", true, 120);

ImgBtnEndRow();

</PDM_IF>

</SCRIPT>

<PDM_IF "$prop.form_name_3" == "ro">

<PDM_IF "$args.status.allow_task_update" == "1" || "$args.status.code" == "COMP">

<PDM_FORM NAME="frmDTLRO">

<INPUT TYPE=hidden NAME=FACTORY VALUE=wf>

<INPUT TYPE=hidden NAME=SET.id  VALUE="$args.id">

<INPUT TYPE=hidden NAME=OP>

<SCRIPT LANGUAGE="JavaScript">

ImgBtnRow();

ImgBtnCreate("btn001", msgtext(513), "pdm_submit('frmDTLRO','UPDATE')", true, 120);

</SCRIPT>

</PDM_FORM>

</PDM_IF>

<SCRIPT LANGUAGE="JavaScript">

ImgBtnEndRow();

</SCRIPT>

</PDM_IF>

<SCRIPT>

<PDM_MACRO NAME=dtlStart>

<PDM_MACRO NAME=dtlStartRow>

<PDM_MACRO NAME=dtlReadonly hdr=Task attr="task.sym">

<PDM_MACRO NAME=dtlReadonly hdr=Assignee attr="assignee">

<PDM_IF "$prop.form_name_3" == "edit">

detailRowHdr("Status", 1 , "$args.REQUIRED_status");

var item = '<PDM_SELECT NAME=SET.status ESC_STYLE=HTML FACTORY=tskstat WF_FAC_FOR_TSKSTAT=wf SELECTED="$args.status" SELECTED_SYM="$args.status.COMMON_NAME">';

var ins_pos = item.indexOf("NAME=");

if (ins_pos > 0)

{

  _dtl.tabIndex++;

  item = item.substring(0, ins_pos) + " TABINDEX=" + _dtl.tabIndex + " " + item.substring(ins_pos, item.length);

}

detailSetRowData(item);

<PDM_ELSE>

<PDM_MACRO NAME=dtlReadonly hdr=Status attr="status.sym">

</PDM_IF>

<PDM_MACRO NAME=dtlStartRow>

<PDM_MACRO NAME=dtlTextbox hdr="Task Description" attr="description" size=70 colspan=4 rows=4 spellchk=yes>

 

<!-- BEGIN CHANGE DETAILS -->

<PDM_IF "$prop.form_name_3" == "ro">

<PDM_MACRO NAME=dtlStartRow>

<PDM_MACRO NAME=dtlReadonly hdr=Change# attr="chg.chg_ref_num">

<PDM_MACRO NAME=dtlReadonly hdr=Category attr="chg.category.sym">

<PDM_MACRO NAME=dtlReadonly hdr=Requestor attr="chg.requestor.combo_name">

<PDM_MACRO NAME=dtlReadonly hdr="End User" attr="chg.affected_contact.combo_name">

<PDM_MACRO NAME=dtlStartRow>

<PDM_MACRO NAME=dtlReadonly hdr="Change Description" attr="chg.description" colspan=4>

</PDM_IF>

<!-- END CHANGE DETAILS -->

 

<PDM_MACRO NAME=dtlEndTable>

</SCRIPT>

 

<!-- BEGIN CHANGE ATTACHMENTS -->

<PDM_IF "$prop.form_name_3" == "ro" && $args.chg.attachments.length != 0 >

<P>

<TABLE WIDTH=90%>

<SCRIPT>

document.writeln("<TR>");

document.write("<TH CLASS=detailro ALIGN=left VALIGN=top>Attachments");

document.writeln("</TH>");

document.writeln("</TR>");

<PDM_LIST SOURCE=args.chg.attachments>

attdata[++lnkid] = new Object();

attdata[lnkid].id = "$args.chg.attachments.id";

attdata[lnkid].attmnt_name = unescape('<PDM_FMT ESC_STYLE=JS2>$args.chg.attachments.attmnt_name</PDM_FMT>');

attdata[lnkid].orig_file_name = unescape('<PDM_FMT ESC_STYLE=JS2>$args.chg.attachments.orig_file_name</PDM_FMT>');

attdata[lnkid].status = "$args.chg.attachments.status";

<PDM_IF "$args.chg.attachments.link_only" != "1">

attdata[lnkid].cgi_path ="$args.chg.attachments.repository.servlet_path";

attdata[lnkid].protocol = "servlet";

attdata[lnkid].server = "$args.chg.attachments.repository.server";

attdata[lnkid].retrieve_path = "$args.chg.attachments.repository.retrieve_path";

attdata[lnkid].file_name = "$args.chg.attachments.file_name";

</PDM_IF>

document.writeln("<TR>");

document.write("<TD CLASS=detailro ALIGN=left VALIGN=top>");

var link = "<A HREF=\"javascript:download_exec(attdata[" + lnkid + "])\">";

document.write(link + '<PDM_FMT esc_style=c><PDM_FMT JUSTIFY=TRUNCATE WIDTH=40>$args.chg.attachments.attmnt_name</PDM_FMT></PDM_FMT></A>');

document.writeln("</TD>");

document.writeln("</TR>");

</PDM_LIST>

</SCRIPT>

</table>

</P>

</PDM_IF>

<!-- END CHANGE ATTACHMENTS -->

 

<PDM_MACRO NAME=dtlEnd>

<PDM_INCLUDE FILE=std_footer.htmpl>

</BODY>

</HTML>

<PDM_WSP>


Step 5. Clear the web cache

The final step is to clear Service Desk's cache. Publish your changes via the Web Screen Painter. The process of publishing automatically initiates a pdm_webcache.

Outcomes