How to synchronize using of another workflow variable using beanShell 

Confluence User - 06 May, 2021

I have 2 workflow (Main and voting )

when the main workflow generate voting processes 

Main contains 2 workflow variables:

voteYes - number of processes(voting workflow) that votes yes

voteNo - number of processes(voting workflow) that votes no

voted - number of voted users

In voting activity

there is only one activity that user vote yer/no then a tool that increment the voted variable and increment voteYes if he choose yes

code:

String count = workflowManager.getProcessVariable(mainProcessId, variableName);
int countInt;
countInt = Integer.parseInt(count) + 1;
count = Integer.toString(countInt);
workflowManager.processVariable(mainProcessId, variableName, count);


the problem:

No synchronization , If 5 users vote together the main variables will not be correct

How to synchronize using of another workflow variable using beanShell 
Is there a way to add OS metaphor, Semaphor or Mutex

synchronize;synchronization;workflow;beanshell;workflow_variable

1


07 May, 2021
confluenceUser
confluenceUser

Hi, you may want to change your app design to capture each individual user vote. In this case, then you can easily perform a sum or any other analysis on the votes as required.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print