Manual:Extension/Workflows/Activity/GroupVote: Difference between revisions

No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 16: Line 16:
|<code>group_vote</code>
|<code>group_vote</code>
|}
|}
==Extension elements==
{| class="wikitable" style="width:100%;"
!'''Name of extension element'''
!'''Description'''
!'''Type'''
|-
|<code>threshold</code>
|Multiple thresholds can be defined
|element
|-
|<code>threshold/type</code>
|Arbitraty identifier, to be used in the connected gateway
|string
|-
|<code>threshold/value</code>
|Either absolute or relative number of users. Depends on <code>unit</code>.
|int
|-
|<code>threshold/unit</code>
|Either <code>user</code> or <code>percent</code>.
|string
|}
===Example===
<syntaxhighlight lang="xml">
<bpmn:extensionElements>
  <wf:type>group_vote</wf:type>
  <wf:threshold>
  <wf:type>yes</wf:type>
<wf:value>3</wf:value>
<wf:unit>user</wf:unit>
    </wf:threshold>
    <wf:threshold>
  <wf:type>no</wf:type>
<wf:value>10</wf:value>
<wf:unit>percent</wf:unit>
    </wf:threshold>
</bpmn:extensionElements>
<bpmn:outgoing>FromGroupVoteToGatewayGroupVote</bpmn:outgoing>
</syntaxhighlight>Once one of the thresholds is reached, the activity will be completed and a <code><bpmn:exclusiveGateway></code> (referenced by <code><bpmn:outgoing></code>) will be called. It will choose its outgoing <code><bpmn:sequenceFlow></code> by mapping its <code>name</code> to the "type" of the threshold that has been reached.<syntaxhighlight lang="xml">
<bpmn:exclusiveGateway id="GatewayGroupVote">
  <bpmn:incoming>FromGroupVoteToGatewayGroupVote</bpmn:incoming>
  <bpmn:outgoing>FromGatewayUserVoteToApproveRevision</bpmn:outgoing>
  <bpmn:outgoing>FromGatewayUserVoteToSendMail</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow
    name="yes"
    id="FromGatewayGroupVoteToApproveRevision"
    sourceRef="GatewayGroupVote"
    targetRef="ApproveRevision"
/>
<bpmn:sequenceFlow
    name="no"
    id="FromGatewayGroupVoteToSendMail"
    sourceRef="GatewayGroupVote"
    targetRef="SendMail"
/>
</syntaxhighlight>
==Properties==
==Properties==
{| class="wikitable" style="width:100%;"
{| class="wikitable" style="width:100%;"
!'''Name of property'''
!'''Name of property'''
!'''Source'''
!'''Description'''
!'''Description'''
!'''Type'''
!'''Type'''
|-
|-
|<code>due_date</code>
|<code>due_date</code>
|<code>UIActivity</code>
|Due date for task completion
|Due date for task completion
|date/timestamp
|date/timestamp
|-
|-
|<code>assigned_group</code>
|<code>assigned_group</code>
| -
|Name of the user group that should vote; can be plain grouname as used in the DB (e.g. "sysop")
|Name of the user group that should vote; can be plain grouname as used in the DB (e.g. "sysop")
|string
|string
|-
|-
|<code>instructions</code>
|<code>instructions</code>
| -
|Text that is shown to the group of user, so they know what to vote about
|Text that is shown to the group of user, so they know what to vote about
|string
|string
|-
|-
|<code>users_voted</code>
|<code>users_voted</code>
| -
|Not to be set in the workflow definition. Used to store data during the activities life cycle. E.g.<syntaxhighlight lang="json">
|Not to be set in the workflow definition. Used to store data during the activities life cycle. E.g.<syntaxhighlight lang="json">
[
[
Line 110: Line 44:
<code><nowiki>{{<GroupVoteActivityID>.0.userName}}</nowiki></code>
<code><nowiki>{{<GroupVoteActivityID>.0.userName}}</nowiki></code>
|string
|string
|-
|<code>threshold_yes_unit</code>
|can be <code>user</code> or <code>percent</code> - absolute number of users required to a approve a page
|user, percent
|-
|<code>threshold_yes_value</code>
|number of users or percentage of users required to approve a page
|
|-
|<code>threshold_no_unit</code>
|can be <code>user</code> or <code>percent</code> - absolute number of users required to a reject a page
|user, percent
|-
|<code>threshold_no_value</code>
|number of users or percentage of users required to reject a page
|
|}
|}
== Full example ==
Once one of the thresholds is reached, the activity will be completed and a <code><bpmn:exclusiveGateway></code> (referenced by <code><bpmn:outgoing></code>) will be called. It will choose its outgoing <code><bpmn:sequenceFlow></code> by mapping its <code>name</code> to the "type" of the threshold that has been reached.
In this example, after the first user either voted yes or no, the workflow will simply reach the end point:<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wf="http://hallowelt.com/schema/bpmn/wf" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1vrglfw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="8.7.1">
<!-- Process part -->
<bpmn:process id="Group_Vote" isExecutable="false">
<bpmn:extensionElements>
<wf:context>
<wf:contextItem name="pageId"/>
    <wf:contextItem name="revision"/>
</wf:context>
</bpmn:extensionElements>
<!-- StartEvent -->
<bpmn:startEvent id="TheStart">
<bpmn:outgoing>FromTheStartToGroupVote</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="FromTheStartToGroupVote" sourceRef="TheStart" targetRef="GroupVote"/>
<!-- Collect group vote -->
<bpmn:userTask id="GroupVote" name="GroupVote">
<bpmn:extensionElements>
<wf:type>group_vote</wf:type>
</bpmn:extensionElements>
<bpmn:property name="assigned_group">QM-reviewer</bpmn:property>
<bpmn:property name="instructions">Please vote</bpmn:property>
<bpmn:property name="comment"/>
<bpmn:property name="vote">vote</bpmn:property>
<bpmn:property name="users_voted"/>
<bpmn:property name="due_date">{{#time:YmdHis|now + 7days}}</bpmn:property>
<bpmn:property name="threshold_yes_unit">user</bpmn:property>
<bpmn:property name="threshold_yes_value">1</bpmn:property>
<bpmn:property name="threshold_no_unit">user</bpmn:property>
<bpmn:property name="threshold_no_value">1</bpmn:property>
<bpmn:incoming>FromtheStartToGroupVote</bpmn:incoming>
<bpmn:outgoing>FromGroupVoteToGatewayGroupVote</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="FromGroupVoteToGatewayGroupVote" sourceRef="GroupVote" targetRef="GatewayGroupVote"/>
<!-- Check on voting -->
<bpmn:exclusiveGateway id="GatewayGroupVote" name="GroupVote.vote">
<bpmn:incoming>FromGroupVoteToGatewayGroupVote</bpmn:incoming>
<bpmn:outgoing>FromGatewayGroupVoteToTheEndYes</bpmn:outgoing>
  <bpmn:outgoing>FromGatewayGroupVoteToTheEndNo</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="FromGatewayGroupVoteToTheEndYes" name="yes" sourceRef="GatewayGroupVote" targetRef="TheEnd"/>
<bpmn:sequenceFlow id="FromGatewayGroupVoteToTheEndNo" name="no" sourceRef="GatewayGroupVote" targetRef="TheEnd"/>
<!-- EndEvent -->
<bpmn:endEvent id="TheEnd">
<bpmn:incoming>FromGatewayGroupVoteToTheEndYes</bpmn:incoming>
          <bpmn:incoming>FromGatewayGroupVoteToTheEndNo</bpmn:incoming>
</bpmn:endEvent>
</bpmn:process>
</bpmn:definitions>
</syntaxhighlight>

Latest revision as of 13:02, 30 October 2023

Description

The activity GroupVote is responsible for collecting necessary data about the voting of a group on a special topic. Unlike the UserVote, it is not possbile to delegate the task. A user that is part of a group can accept or decline a vote and also leave a comment that justifies their decision. The voting result is determined by whatever threshold has been reached first and ends the activity.

Short profile
Name GroupVote
Async No
BPMN type bpmn:userTask
BPMN Extension Element "wf:type" group_vote

Properties

Name of property Description Type
due_date Due date for task completion date/timestamp
assigned_group Name of the user group that should vote; can be plain grouname as used in the DB (e.g. "sysop") string
instructions Text that is shown to the group of user, so they know what to vote about string
users_voted Not to be set in the workflow definition. Used to store data during the activities life cycle. E.g.
[
    { "userName": "UserA", "vote": "yes", "comment": "Good" },
    { "userName": "UserB", "vote": "no",  "comment": "Not good" }
]
Can be accessed by follow up activitites by e.g.

{{<GroupVoteActivityID>.0.userName}}

string
threshold_yes_unit can be user or percent - absolute number of users required to a approve a page user, percent
threshold_yes_value number of users or percentage of users required to approve a page
threshold_no_unit can be user or percent - absolute number of users required to a reject a page user, percent
threshold_no_value number of users or percentage of users required to reject a page

Full example

Once one of the thresholds is reached, the activity will be completed and a <bpmn:exclusiveGateway> (referenced by <bpmn:outgoing>) will be called. It will choose its outgoing <bpmn:sequenceFlow> by mapping its name to the "type" of the threshold that has been reached.

In this example, after the first user either voted yes or no, the workflow will simply reach the end point:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wf="http://hallowelt.com/schema/bpmn/wf" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1vrglfw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="8.7.1">
	<!-- Process part -->
	<bpmn:process id="Group_Vote" isExecutable="false">
		<bpmn:extensionElements>
			<wf:context>
				<wf:contextItem name="pageId"/>
			    <wf:contextItem name="revision"/>
			</wf:context>
		</bpmn:extensionElements>
		<!-- StartEvent -->
		<bpmn:startEvent id="TheStart">
			<bpmn:outgoing>FromTheStartToGroupVote</bpmn:outgoing>
		</bpmn:startEvent>
		<bpmn:sequenceFlow id="FromTheStartToGroupVote" sourceRef="TheStart" targetRef="GroupVote"/>
			<!-- Collect group vote -->
		<bpmn:userTask id="GroupVote" name="GroupVote">
			<bpmn:extensionElements>
				<wf:type>group_vote</wf:type>
			</bpmn:extensionElements>
			<bpmn:property name="assigned_group">QM-reviewer</bpmn:property>
			<bpmn:property name="instructions">Please vote</bpmn:property>
			<bpmn:property name="comment"/>
			<bpmn:property name="vote">vote</bpmn:property>
			<bpmn:property name="users_voted"/>
			<bpmn:property name="due_date">{{#time:YmdHis|now + 7days}}</bpmn:property>

			<bpmn:property name="threshold_yes_unit">user</bpmn:property>
			<bpmn:property name="threshold_yes_value">1</bpmn:property>
			<bpmn:property name="threshold_no_unit">user</bpmn:property>
			<bpmn:property name="threshold_no_value">1</bpmn:property>

			<bpmn:incoming>FromtheStartToGroupVote</bpmn:incoming>
			<bpmn:outgoing>FromGroupVoteToGatewayGroupVote</bpmn:outgoing>
		</bpmn:userTask>
		<bpmn:sequenceFlow id="FromGroupVoteToGatewayGroupVote" sourceRef="GroupVote" targetRef="GatewayGroupVote"/>
		<!-- Check on voting -->
		<bpmn:exclusiveGateway id="GatewayGroupVote" name="GroupVote.vote">
			<bpmn:incoming>FromGroupVoteToGatewayGroupVote</bpmn:incoming>
			<bpmn:outgoing>FromGatewayGroupVoteToTheEndYes</bpmn:outgoing>
		   <bpmn:outgoing>FromGatewayGroupVoteToTheEndNo</bpmn:outgoing>
		</bpmn:exclusiveGateway>
		<bpmn:sequenceFlow id="FromGatewayGroupVoteToTheEndYes" name="yes" sourceRef="GatewayGroupVote" targetRef="TheEnd"/>
		<bpmn:sequenceFlow id="FromGatewayGroupVoteToTheEndNo" name="no" sourceRef="GatewayGroupVote" targetRef="TheEnd"/>
		<!-- EndEvent -->
		<bpmn:endEvent id="TheEnd">
			<bpmn:incoming>FromGatewayGroupVoteToTheEndYes</bpmn:incoming>
           <bpmn:incoming>FromGatewayGroupVoteToTheEndNo</bpmn:incoming>
		</bpmn:endEvent>
	</bpmn:process>
</bpmn:definitions>




To submit feedback about this documentation, visit our community forum.