]project-open[ workflow developer tutorial part 3

36
]project-open[ Workflow Tutorial Part 3: Customization, Graphical User Interface, business logic and other advanced topics Start Place Transition End Transition [Not OK] [OK]

Upload: projectopen

Post on 12-Jan-2015

6.603 views

Category:

Technology


7 download

DESCRIPTION

Customization, Graphical User Interface, business logic and other advanced topics

TRANSCRIPT

Page 1: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ Workflow Tutorial

Part 3: Customization, Graphical User Interface, business logic and other advanced topics

Start

Place

Transition

End

Transition

[Not OK]

[OK]

Page 2: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 2

Tutorial Overview

PO-Workflow-Tutorial-1-Overview.ppt This document provides a short overview of the ]project-open[ workflow.

PO-Workflow-Tutorial-2-EDI-Example.ppt:The next section guides you step-by-step through a real-world EDI Message workflow scenario.

PO-Workflow-Tutorial-3-Cusomizations.pptThe third section deals with the customization of the workflow to implement custom business logic, custom GUI panels and custom assignments.

Page 3: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 3

Customizing Workflow Panels

Page 4: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 4

EDI Message WF Customer Satisfaction Survey

According to the business specs from the 1st part of this tutorial, the customer should fill out a customer satisfaction survey to determine the quality of the work.

In the real world, this survey is used to calculate the bonus of the message development team…

We are now going to configure this “Simple Survey” as part of the workflow.

Page 5: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 5

Default Workflow “Panels”

By default, the workflow shows:– The default Object Panel on the

left hand side with the name of the object and its type.

– The default Action Panel with a “Start task” button. The panel will show a “Task done” once the task is started or a yes/no select if this transition was configured as a loop.

– “Administrative actions” are only shown to users with workflow admin permissions

– The “Journal” contains an audit log of past actions, their time and the person executing them.

Object Panel Action Panel

Page 6: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 6

Setup Simple Survey

Please setup a Simple Survey in Admin -> Simple Surveys similar to the one at the right hand side.

To test the survey please go to any Project and click on the “Take survey” link in the “Project Surveys” portlet.

Page 7: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 7

Set our Simple Survey as Workflow Panel

Go to your workflow and select the “Panels” page. It shows a list of WF transitions and their panels. Click on “add panel”.

The “Header” is used to select the corresponding simple survey. Please make sue the header contains the name of an active simple survey (case sensitive!).

The /packages/ simple-survey/ www/ one page has been previously enabled to act as a workflow panel.

“Override default Action panel” specifies if we want to override the left (object) or the right (action) panel.

Setting “Override both panels” to “yes” means that our Simple Survey panel will override both panels.

Page 8: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 8

Workflow Transition with Customer Satisfaction Survey

The finished custom panel shows the working Customer Satisfaction Survey.

Pressing “Continue” will automatically finish the workflow task. This behavior has been coded into the /package/ simple-survey/ www/ process-response.tcl page.

Page 9: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 9

Create Your Own Panel

Any valid TCL page can be used as a workflow panel, if it complies with some conventions:– The page should

return a simple piece of HTML without <HTML>, <HEAD> and <BODY> tags, so you want to disable the ]po[ header in general.

– The page should not include a ad_page_contract.

<!-- /packages/intranet-workflow/www/panels/hello-world.tcl -->

<h1>Hello World</h1><p>The following list shows all entriesin the "task" hash available.</p><table>@debug_html;noquote@</table>

# /packages/intranet-workflow/www/panels/hello-world.tcl

# Show all available task informationset debug_html ""foreach var [array names task] { set val $task($var) append debug_html "<tr><td>$var=</td><td>$val</td></tr>\n"}

ad_return_template

Page 10: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 10

Other Existing WF Panels

The following pages have been prepared to act a workflow panels: Hello World example & tutorial:

/packages/ intranet-workflow/ www/ panels/ hello-world Absences:

/packages/ intranet-timesheet2-workflow/ www/ absences/ absence-panel

Tickets:/packages/ intranet-helpdesk/ www/ new

Simple Surveys (uses the panel header as name of the survey to show):/packages/ simple-survey/ www/ one

Expense Bundles:/packages/ intranet-expenses/ www/ bundle-new

Timesheet Hours:/packages/ intranet-timesheet2-workflow/ www/ conf-objects/ conf-obj-panel

Page 11: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 11

Simple Status Reporting

Page 12: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 12

Inform the PM About the Status

The objective of status reporting is to tell stakeholders quickly about the progress of the workflow.

One simple option is reporting via the underlying business object: The WF update the status of the business object, and this status is shown in the ]po[ GUI.

The screenshots at the right hand side shows how the project status is reported:

– In the “Projects” page, the status of each main project is shown. This is useful, if the workflow is associated with a top-level projects.

– The 2nd screenshot shows the “Project Hierarchy” portlet of a project with the status of its sub-projects. This is useful if the workflow is associated with sub-projects, as it is the case in the EDI Message development example.

Page 13: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 13

Business Object Status Updates

Every workflow stage can update the status of the underlying business object. Examples:– Approval workflows:

The object’s status is set to “accepted” or “rejected” depending on workflow decisions

– Lifecycle workflows:The workflow controls the lifecycle of an object (EDI Message WF).

The diagram at the right hand side shows an example on how the status of an EDI Message project could be updated from a workflow

Analysis

Developing

QC Checking

Getting UA

Deployed

Maintenance

Business ObjectStatus

Page 14: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 14

Status Reporting: How to Implement

Setup a new CategoryExample: Project status: “Analyzing”

Make the new category a sub-category of the project status “Open”

Add a “callback” to the WF transition to update the status

Page 15: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 15

Status Reporting: Create a New Category

Create a new category of type “Intranet Project Type”.

After creating the category please “edit” again and select “Open” in the “Is-A” list. This way, the status becomes a sub-status of “Open”

Page 16: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 16

Status Reporting: Callbacks to Set the Object State

In the WF admin page got to “Graphical Process Editor”, select the desired transition and click on “Actions” to see the screen at the right.

In the “Enable” callback write “im_workflow__set_object_status_id” and “60000” in the “Custom Argument” field (60000 is the category_id of the new project status “Business Analysis” that we have created in the last step.

The “Enable” callback is executed _before_ the task is started, so this is the right place to set the status of the project.

Page 17: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 17

Computed Assignments: Assign the Project Admin(s) to a Transition

Page 18: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 18

Business Case: Assign Project Admins

Let’s assume that you want to assign the project administrators to a transition.

“Project admins” are users in the “Project Members” component with role “project manager”.

We will use the “Unassigned Callback” of the transition’s “Action” page to execute a PL/SQL procedure to assign the users.

Page 19: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 19

Data-Model: Identify Project Admins

How can we assign the project manager of a project to a workflow task?

The data-model on the right-hand side shows how to identify the “Project Members” of a project and the corresponding SQL query.

The object_role_id of the im_biz_object_members table identifies the type of relationship between the user and the project. Project Admin relationships are identified by catgory-id = 1301.

im_projects

• project_id• project_name• …

wf_cases

• case_id• workflow_key• object_id

cc_users

• user_id• username• first_names• last_name• …

acs_rels

• rel_id• rel_type• object_id_one• object_id_two

im_biz_objectmembers

• rel_id• object_role_id

im_categories

• category_id• category• category_type

=1301

select r.object_id_two as user_id, im_name_from_user_id(r.object_id_two) as name

from wf_cases wfc,im_projects p,acs_rels r,im_biz_object_members bom

where wfc.object_id = p.project_id andr.object_id_one = p.project_id andr.rel_id = bom.rel_id andbom.object_role_id = 1301;

Page 20: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 20

Data-Model: Identify Project Admins

The PL/SQL procedure will assign project admins to the current task, there was no manual or static assigments.

The procedure is part of ]po[ and available in /packages/ intranet-workflow/ sql/ postgresql/ workflow- callback- procs.sql

create or replace function im_workflow__assign_to_project_admins (integer, text, text)returns integer as 'declare p_case_id alias for $1; p_transition_key alias for $2; p_custom_arg alias for $3; v_task_id integer; v_case_id integer; v_creation_ip varchar; v_creation_user integer; v_object_id integer; v_object_type varchar; v_journal_id integer; v_transition_key varchar; v_workflow_key varchar; row RECORD;begin -- Select out some frequently used variables of the environment select c.object_id, c.workflow_key, task_id, c.case_id, co.object_type, co.creation_ip into v_object_id, v_workflow_key, v_task_id, v_case_id, v_object_type, v_creation_ip from wf_tasks t, wf_cases c, acs_objects co where c.case_id = p_case_id and c.case_id = co.object_id and t.case_id = c.case_id and t.workflow_key = c.workflow_key and t.transition_key = p_transition_key;

FOR row IN select r.object_id_two as user_id, im_name_from_user_id(r.object_id_two) as user_name from wf_cases wfc, im_projects p, acs_rels r, im_biz_object_members bom where wfc.case_id = v_case_id and wfc.object_id = p.project_id and r.object_id_one = p.project_id and r.rel_id = bom.rel_id and bom.object_role_id = 1301 LOOP v_journal_id := journal_entry__new( null, v_case_id, v_transition_key || '' assign_to_user '' || row.user_name, v_transition_key || '' assign_to_user '' || row.user_name, now(), v_creation_user, v_creation_ip, ''Assigning to '' || row.user_name ); PERFORM workflow_case__add_task_assignment(v_task_id, row.user_id, ''f''); PERFORM workflow_case__notify_assignee (v_task_id, row.user_id, null, null, ''wf_'' || v_object_type || ''_assignment_notif''); END LOOP;

return 0;end;' language 'plpgsql';

Page 21: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 21

Notifications and Emails

Page 22: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 22

Notifications Background

Workflow Notifications are a very sensitive subject, because of the profile of the notified users (managers, customers and employees)

Too many notifications are considered intrusive and may cause strong emotional reactions.

The problem appears particularly if many users are assigned to a transition, because only one of the users will actually perform the WF task.

Only users “assigned” to a WF task may actually start a WF task (unless they are WF administrators). For this reason we need to assign all users who might(!) want to execute the task.

Page 23: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 23

Static and Manual Assignment Notifications

A callback exists to Transitions assigned to users via

static and manual assignments can be

Page 24: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 24

Notification Computed Assignments

The computed assignment procedures automaticll

Page 25: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 25

Various Hints

Page 26: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 26

Changing the size of the WF Component

Are the workflow in the “Project WF Graph” portlet too large or too small for your typical workflows?

In Admin -> Parameters -> intranet-workflow you can modify the size of the workflow graphs.

Page 27: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 27

Notifications for late Transitions

Complicated solution: Add timeout logic to each of the transitions. This would clutter the WF a lot…

Better solution:Create a report that lists all late WF transitions and add a “batch-action” to send out mass-emails to the users with late transitions.

Page 28: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 28

Page 29: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 29

Page 30: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 30

Page 31: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 31

Page 32: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 32

Portlet Integration

Project View Page (TCL)

Project Base Data

Finance Info

ProjectHierarchy

Forum

im_component_plugins

• plugin_id - 12345• plugin_name - Forum• package_name - intranet-forum• sort_order - 20• page_url - /intranet/index• location - right• component_tcl - …• enabled_p - t

im_forum_component \-user_id $user_id \-forum_object_id $project_id \-current_page_url $current_url \-return_url $return_url \-forum_type "project"

component_tcl

user_id = $user_idforum_object_id = …

Page 33: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 33

Page 34: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 34

Workflow Notifications

Option 1: Use “im_workflow__assign_to_group” + group name in the “Unassigned Callback” of a transition

Option 2:Notification CallbackCheck Google…

Page 35: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 35

Frequently Used Assignment Callbacks

assign_to_owner – assign the task to the business object’s creator

assign_to_supervisor – assign the task the supervisor of the business object’s creator

assign_to_group – assign to the members of a particular group

Page 36: ]project-open[ Workflow Developer Tutorial Part 3

]project-open[ 2010, Frank Bergmann / 36

Linear vs. Real-World Workflows

asdfLinear version of the

EDI Message workflow.

Start

BusinessAnalysis

End

CheckSpecs

[Not OK]

[OK]

DevelopMessage

QCCheck

[OK]

[Not OK]

QA

Release toProduction

[OK] 30 daysMaintenance

[OK]

[Not OK]

UserAcceptance

[OK]

[OK]

[Not OK]

[Not OK]

[Not OK]

User Survey

[OK]

ResourceAssignment