Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Retrive fork transitions names in javascript

Avatar

Level 1

Hi all, 

 

is it possible to retrieve fork transitions names from javascript?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

You can get them by searching workflow for transitions with your activity as target.

Transition object types can change depending on the activity (e.g. fork is weird), so just copy this and alter as needed:

 

var transitions = [];
for each (var activities in instance.activities) {
  for each (var instanceActivity in activities) {
    for each (var transition in instanceActivity.transitions) {
      if (transition.target === activity.name) transitions.push(transition.name);
      for each (var transition2 in transition) {
        if (transition2.target === activity.name) transitions.push(transition2.name);
      }
    }
  }
}

 

Thanks,

-Jon

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

 

You can get them by searching workflow for transitions with your activity as target.

Transition object types can change depending on the activity (e.g. fork is weird), so just copy this and alter as needed:

 

var transitions = [];
for each (var activities in instance.activities) {
  for each (var instanceActivity in activities) {
    for each (var transition in instanceActivity.transitions) {
      if (transition.target === activity.name) transitions.push(transition.name);
      for each (var transition2 in transition) {
        if (transition2.target === activity.name) transitions.push(transition2.name);
      }
    }
  }
}

 

Thanks,

-Jon