Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Use Work Activity

  • Last UpdatedJun 10, 2024
  • 8 minute read

AVEVA Work Tasks provides standard activities, which can be used for creating the workflows. The Work activity is one of the most powerful and flexible among them. The Work activity can be created based on user roles and without roles. The UI to configure the Work activity properties can be displayed in either a Role Based View or a General View. This reduces much of the need for creating custom activities.

The Role-based Work activity is used to provide the flexibility of showing the UI based on the user role. The Work action is configured using XML configuration files and a HTML template to render the UI in the Work Item Detail view.

Work Action with General Functionality (without Role):

  • Users will only be able to show the same UI in the Work Item List – based on the AdvanceUI Fields property set for the Work Activity – to all users who log in, without any control over what information they may be allowed to view or may be interested in viewing.

  • Users have to select the XML file to be used to specify the configuration in the AdvanceUI Fields property. (The HTML Template file that will be using these configuration settings to render the output is also specified in this XML file.)

  • Users also have to specify the possible outputs for the Activity (Action Outputs), Template Placeholders used to render the button value or drop down, and the Output Variables used to store information such as comments in workflow variables, in the AdvanceUI Fields property.

Work Action with Role Based Functionality:

  • Users will be able to show a customized UI in the Work Item List – based on the AdvanceUI Fields property set for the Work Activity – to each user who logs in, based on their user role. As a result the UI can be dependent on what information they may be allowed to view or may be interested in viewing.

  • Users have to specify in the AdvanceUI Fields property, which XML file is to be used to render the output for each role defined.

  • Users also have to specify the possible outputs for the Action (Action Outputs), Template Placeholders used to render the button value or drop down, and the Output Variables used to store information such as comments in workflow variables, in the AdvanceUI Fields property.

The "Approve Reject and Escalate.xml" XML configuration file is shown below

Elements and attributes specified in the XML file:

Template Name: The name of the HTML file that will be used by this action to render it in the UI control is specified in the <HtmlTemplate> element.

GroupUIHtmlTemplate: This is not getting used and it is kept for Backward compatibility.

ActionOutPut Variables: The ActionOutput variables that are used to specify all the possible outcomes for the action are specified using the ActionOutput element. The attributes to be specified are described here.

  • Name: The name of the ActionOutput variable.

  • Completion Maker: The setting that will determine whether the action is completion maker or not.

  • Alias: The alias name for the Output that will be displayed as the output when the action is linked in the workflow.

Input Variables: The Input Variables that are used to fill the button values, drop down values, etc., are configured using the InputVariable element. The values for the input variables are associated with workflow variables or with static values. The attributes to be specified are described here.

  • Name: The name of the input variable that will be used as the placeholder in the HTML template.

  • Type: The field type that is used to define whether it will be a text box or drop down.

  • Desc: A short description of the purpose of the Variables.

  • Values: The values to be associated with the variables; Comma separated values need to be specified in the case of drop down (Yes/No).

  • DefaultValue: The default value for this variable; it can be static value, variable collection value, and content value.

  • ValueType: The value type that is used to define whether it will be a variable or content or static value.

Output Variables: The Output Variables that will be used to store the values from various attributes are configured using the OutputVariable elements. The attributes to be specified are described here.

  • Name: The name of the output variable; it will be the same as the HTML Element Id.

  • Desc: A short description of the purpose of the Variables.

  • Html Element Id: The name of the HTML element from which the value has to be read.

  • Valuestoset: The type to which value has to be stored (Variable/Content).

    Note: When you use Input Variables for displaying the button value that will render in the UI, you need to make sure that the Input Variable value and the ActionOutput variable Alias value denoted as Mapped Outputs must be the same.

The "Approve Reject and Escalate.htm" HTML Template file is shown below:

(This template uses the parameters defined in the "Approve Reject and Escalate.xml" file to render the UI to the user.)

The part of the HTML Template where the placeholders are replaced with the input variables configured in the XML file is shown below. This template should have a hidden variable named actionOutPut, for capturing the value inside the control for alerting the action.

<link rel="styles" type="text/css" href="<%#VDir%>/StyleSheet/global.css">

<TABLE WIDTH="100%" height="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2" class="tablebg">

<%#errorMessage%>

<TR VALIGN="TOP">

<TD align="left" width="<%#iframewidth%>" bgcolor="<%#iframebgcolor%>">

<%#iframeui%>

</TD>

<TD class="righttdbg">

<TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="5">

<TR CLASS="subtitle">

<TD align=left>

@@Comments@@

</TD>

</TR>

<TR>

<TD align=left>

<TEXTAREA name="txtcomment" cols=30 rows=6 wrap="VIRTUAL" class="inputtextarea"><%#txtcomment%></TEXTAREA>

</TD>

</TR>

<!--<TR>

<TD align="center">&nbsp;</TD>

</TR>-->

</TABLE>

</TD>

</TR>

<TR class="lefttdbg">

<!--Place holder <%#approvealias%> will be replaced by the input variable approvealias specified in the Xml Config file -->

<TD align="right" class="lefttdbg" Colspan="2">

<input type="Submit" class="inputbutton" name="btnClickSubmit" value="<%#approvealias%>" onclick="javascript:BtnClicked(this)">

<!--Place holder <%#rejectalias%> will be replaced by the input variable rejectalias specified in the Xml Config file -->

<input type="Submit" class="inputbutton" name="btnClickSubmit" value="<%#rejectalias%>" onclick="javascript:BtnClicked(this)">

<!--Place holder <%#escalatealias%> will be replaced by the input variable escalatealias specified in the Xml Config file -->

<input type="Submit" class="inputbutton" name="btnClickSubmit" value="<%#escalatealias%>" onclick="javascript:BtnClicked(this)">

</TD>

<input type="hidden" name="actionOutPut" value="" >

</TR>

</TABLE>

<!--

<%#ExecutingActionName%>

<%#ExecutingActionType%>

<%#ExecutionId%>

<%#ExecutionDetailsId%>

<%#ActivityId%>

<%#WorkflowName%>

<%#ApplicationName%>

<%#ActivityResource%>

<%#OnBehalfOfResource%>

-->

<Script>

function BtnClicked(clickObj)

{

document.getElementsByTagName("input")["actionOutPut"].value = clickObj.value;

}

</Script>

Note:The placeholder name used in the template should be the name of the input variables used in the xml file so that the placeholder value will get replaced at run time with the input variable value. In the above example, "approvealias", "rejectalias" and "escalatealias" are the input variables in the Approve Reject and Escalate.xml file.
The function "BtnClicked(clickObj)" is used to capture the output to alert the action with the output.

Steps to create an XML Configuration file for the Work Action:

Consider the example of displaying the UI shown below to the users. For this, you will need to create the XML configuration file and the HTML Template file, say WrkSendBack.xml and WrkSendBack.htm, under the "Workflowelements\Default\en-US\Actions\WorkAction" folder. This section describes the steps to create the XML file.

Specifying the start and end tags:

  • The start tag and end tag for the xml file are <WorkTemplate> and </ WorkTemplate> respectively.

Specifying the HTML Template Name:

  • The next node to specify is <HtmlTemplate>WrkSendBack.htm</HtmlTemplate>, where WrkSendBack.htm is the HTML Template file corresponding to this XML file. This template will also be created under the Workflowelements\Default\en-US\Actions\WorkAction folder.

Specifying Action Outputs:

  • The next node is <ActionOutputs></ ActionOutputs>

  • Inside this node you need to specify all the possible outputs for this action as shown below

    • <ActionOutput name="Approve" CompletionMaker="Yes" Alias=""></ActionOutput>

    • <ActionOutput name="Reject" CompletionMaker="Yes" Alias=""></ActionOutput>

    • <ActionOutput name="Send Back" CompletionMaker="Yes" Alias=""></ActionOutput>

  • You can specify a value in the alias attribute so that it will appear in the AdvanceUI property of Work Action for these action outputs. Alternatively, you can skip setting this attribute here and enter the values in the property.

Specifying Template Placeholders:

  • The next node is <InputVariables></ InputVariables>

  • Inside this node you need to specify all the input variables that you can use to fill the values in the HTML Template (WrkSendBack.htm) for this action

  • For example, let us assume you need to display three buttons in the UI for this work action. The values for these buttons can be filled with the help of Input Variables, which will be used to replace the placeholders in the HTML Template file (WrkSendBack.htm). Inside the node specify the input variables for this action as shown below,

    • <InputVariable name="approvealias" type="textbox" Desc="Replace Word approvealias with" valueType="Value" Defaultvalue="Approve"></InputVariable>

    • <InputVariable name="rejectalias" type="textbox" Desc="Replace Word rejectalias with" valueType="Value" Defaultvalue="Reject"></InputVariable>

    • <InputVariable name="sendbackalias" type="textbox" Desc="Replace Word sendbackalias with" valueType="Value" Defaultvalue="Send Back"></InputVariable>

  • You can specify a value in the alias attribute so that it will appear in the AdvanceUI property of Work Action for these action outputs. Alternatively, you can skip setting this attribute here and enter the values in the property.

Specifying Output Variables:

  • The next node is <OutputVariables></ OutputVariables>

  • Inside this node you need to specify all the Output Variables you will be using to map to workflow variables to store the HTML element values, if required. Specify the variables as shown below.

    • <OutputVariable name="txtcomment" desc="Store Comments In" HtmlElementId="txtComment" valuestoset="Variable"></OutputVariable>

  • The name of the output variable and the name of the HTML Element Id should be the same.

To create a HTML Template file (WrkSendBack.htm) for the Work Action to render the UI shown in the previous section:

<link rel="styles" type="text/css" href="<%#VDir%>/StyleSheet/global.css">

<TABLE WIDTH="100%" Height="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2" class="lefttdbg">

<%#errorMessage%>

<TR VALIGN="TOP">

<TD align="left" width="<%#iframewidth%>" bgcolor="<%#iframebgcolor%>">

<%#iframeui%>

</TD>

<TD class="righttdbg">

<TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="5">

<TR CLASS="subtitle">

<TD align=left>

@@Comments@@

</TD>

</TR>

<TR>

<TD align=left>

<TEXTAREA name="txtcomment" cols=30 rows=6 wrap="VIRTUAL" class="inputtextarea"><%#txtcomment%></TEXTAREA>

</TD>

</TR>

<TR>

<TD align="center">&nbsp;</TD>

</TR>

</TABLE>

</TD>

</TR>

<TR class="tablebg">

<!--Place holder <%#approvealias%> will be replaced by the input variable approvealias specified in the Xml Config file -->

<TD align=right class="lefttdbg" Colspan="2">

<input type="Submit" class="inputbutton" name="btnClickSubmit" value="<%#approvealias%>" onclick="javascript:BtnClicked(this)">

<!--Place holder <%#rejectalias%> will be replaced by the input variable rejectalias specified in the Xml Config file -->

<input type="Submit" class="inputbutton" name="btnClickSubmit" value="<%#rejectalias%>" onclick="javascript:BtnClicked(this)">

<!--Place holder <%#sendbackalias%> will be replaced by the input variable sendbackalias specified in the Xml Config file -->

<input type="Submit" class="inputbutton" name="btnClickSubmit" value="<%#sendbackalias%>" onclick="javascript:BtnClicked(this)">

</TD>

<!-- Hidden variable used to handle for Alerting the Output.The name actionOutPut should be same-->

<input type="hidden" name="actionOutPut" value="" >

</TR>

</Table>

<!--

<%#ExecutingActionName%>

<%#ExecutingActionType%>

<%#ExecutionId%>

<%#ExecutionDetailsId%>

<%#ActivityId%>

<%#WorkflowName%>

<%#ApplicationName%>

<%#ActivityResource%>

<%#OnBehalfOfResource%>

-->

<Script>

<!-- Script used for the logic of assigning the output to the hidden variable actionOutPut Which will be used by the action to alert the output.-->

function BtnClicked(clickObj)

{

document.getElementsByTagName("input")["actionOutPut"].value = clickObj.value;

}

</script>

Note:The <%#Acknowledge%> placeholder is used to display the Read Acknowledgement.
The <%#Notes%> placeholder is used to display the notes if you specify in the action. The <IFRAME> tag is used to display the details page inside an IFrame. The <TEXTAREA> tag is used to show the comments. The "<%#approvealias%>", "<%#rejectalias%>" and "<%#sendbackalias%>" placeholders are used as the input variables in the WrkSendBack.htm file. The "actionOutPut" hidden variable is used to store the output to alert the action with. The function "BtnClicked(clickObj)" is used to capture the output to alert the action with.

To use the created xml file (WrkSendBack.xml) and HTML template (WrkSendBack.htm) in the Work Action:

  1. Click the AdvanceUI Fields property in the Work Activity Actions Properties.

  2. You will see the file name in the File Name drop down (of both General View and Role Based View).

  3. Select this file name and then click Action Outputs or Template Placeholders or Output Variables to display the corresponding property screen; you can see the parameters configured in the xml file displayed in the property screen.

  4. Enter the values in the respective property screen; then save and deploy the workflow.

  5. After you execute the workflow you will find the ActivityUI rendered in the Work Item detailed window.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in