cancel
Showing results for 
Search instead for 
Did you mean: 

Defining variable on ProcessDefinition (Bpmn)

gokceng1
Champ in-the-making
Champ in-the-making
Hi,
I add end listeners to the end events in a process. I've some process definitions that I can ignore the listener with respect to the some variable in process instance. I set this variable according to the key of the process definition. Let's say, if the key ends with "-XYZ", end event listener should trigger something, if not ignore the ending. What if I can decide this using a variable given to the process while designing?
Is this possible?
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
The only current 'solution' is a listener (script) that adds that variable to the process

gokceng1
Champ in-the-making
Champ in-the-making
Thank you. Does BPMN support a feature like this? Maybe I can work on a task like this?

jbarrez
Star Contributor
Star Contributor
BPMN 2.0 does have something like that (called 'properties'), however in our opinion the xml is kind of messy and way too complex.

But something simple like

<code>
<activiti:variable name="something" value="theValue" />
</code>

With a converter for string -> different types might do the trick and isn't that hard to write.

gokceng1
Champ in-the-making
Champ in-the-making
Hi Joram, thanks for the tip.
I've seen something I can do like :
<code><property activiti:elementVariable=""/></code>
inside the <code><process></process></code> tags. Do you know what are they? May I use them something like this?

jbarrez
Star Contributor
Star Contributor
Yes I remember that in some old code, but I don't believe it works (and it is not tested for sure).

But yeah, something like that would work. But of course, with custom mappers to go from xml string value to any other type.

zze_one
Champ on-the-rise
Champ on-the-rise
Hi guys,

Joram, I am very interested in knowing more about this :
<code><activiti:variable name="something" value="theValue" /></code>

How do I tell the validation step to accept this kind of variable ?
so far it returns: ActivitiException: Error parsing XML

Can this variable be stored in one of the activiti tables ?
I'm using Activiti 5.14.

Thanks a lot,

jbarrez
Star Contributor
Star Contributor
Yohann: 5.15 added a new feature which pretty much does this, see http://activiti.org/userguide/index.html#dataobjects

zze_one
Champ on-the-rise
Champ on-the-rise
Thanks Joram.
Congrats for the release by the way too.
Looks like there are plenty of useful stuff that are added (Customized queries my MyBatis …).

gokceng1
Champ in-the-making
Champ in-the-making
Thank you. I think it will be sufficient for us.