WF tasks can be assigned to users or user groups.
The easiest way to assign a task to a group of users is by calling a pg/plsql function when a particular task is fired but hasn't been assigned yet:
Other available pg/plsql routines for task assignments include:
create function im_workflow__assign_to_project_manager(int4,text) returns int4 as '
declare
p_task_id alias for $1;
p_custom_arg alias for $2;
v_transition_key varchar;
v_object_type varchar;
v_case_id integer;
v_object_id integer;
v_creation_user integer;
v_creation_ip varchar;
v_project_manager_id integer;
v_project_manager_name varchar;
v_journal_id integer;
v_workflow_key varchar;
begin
-- Get information about the transition and the 'environment'
select tr.transition_key, t.case_id, c.object_id, o.creation_user, o.creation_ip, o.object_type
into v_transition_key, v_case_id, v_object_id, v_creation_user, v_creation_ip, v_object_type
from wf_tasks t, wf_cases c, wf_transitions tr, acs_objects o
where t.task_id = p_task_id
and t.case_id = c.case_id
and o.object_id = t.case_id
and t.workflow_key = tr.workflow_key
and t.transition_key = tr.transition_key;
select attr_value into v_workflow_key from apm_parameter_values where parameter_id in
(select parameter_id from apm_parameters where package_key like 'intranet-timesheet2-workflow' and parameter_name = 'DefaultWorkflowKey');
RAISE NOTICE 'im_workflow__assign_to_project_manager: Found workflow: %: ', v_workflow_key;
IF v_workflow_key = '' THEN
v_workflow_key := 'timesheet_approval_wf';
RAISE NOTICE 'im_workflow__assign_to_project_manager: No parameter found, set workflow_key to: %: ', v_workflow_key;
END IF;
IF v_object_type = v_workflow_key THEN
select project_lead_id into v_project_manager_id from im_projects
where project_id in (select conf_project_id from im_timesheet_conf_objects where conf_id = v_object_id);
RAISE NOTICE 'im_workflow__assign_to_project_manager: Project Manager ID: %: ', v_project_manager_id;
ELSE
select project_lead_id into v_project_manager_id from im_projects
where project_id = v_object_id;
END IF;
select im_name_from_id(v_project_manager_id) into v_project_manager_name;
IF v_project_manager_id is not null THEN
v_journal_id := journal_entry__new(
null, v_case_id,
v_transition_key || ' assign_to_project_manager ' || v_project_manager_name,
v_transition_key || ' assign_to_project_manager ' || v_project_manager_name,
now(), v_creation_user, v_creation_ip,
'Assigning to user' || v_project_manager_name
);
PERFORM workflow_case__add_task_assignment(p_task_id, v_project_manager_id, 'f');
PERFORM workflow_case__notify_assignee (p_task_id, v_project_manager_id, null, null,
'wf_' || v_object_type || '_assignment_notif');
END IF;
return 0;
end;' language 'plpgsql';
Calle Aprestadora 19, 12o-2a
08902 Hospitalet de Llobregat (Barcelona)
Spain
Tel Europe: +34 609 953 751
Tel US: +1 415 200 2465
Mail: info@project-open.com