AnsweredAssumed Answered

How to reset Array Index in Workflow

Question asked by Diana Sansone on Jul 3, 2019
Latest reply on Jul 4, 2019 by Diana Sansone

Hello everybody,

 

we have the following custom workflow:

 

We have users and related roles. A User can have one ore more roles. We want to print each pair [User-Role].

This is how the workflow works:

  • Select all Users;
  • Use a temporary variable to store each single user;
  • For each single user select all roles related to that user;
  • Use a temporary variable to store each single role;
  • For each single role, print the pair [Single User, Single Role];

Both of "For each" are implemented with a "Next Node".

This node is called multiple times and, each time, the next role for the specified user is returned in the temporary variable. When all roles have been processed, false is returned for the outgoing transition. This logic is done by using an Index, created by the system.

We have a problem with the "For each role" node: when all the roles of the first user have been processed, the Index of the array role contains the number of all the roles associated with the specified user, the loop ends and the second user is processed. When the system processes the second user, the Index of the array role still contains the previous value and so, the cycle never starts.

We tried to reset the Index of the array role using the "Reset array user role index" but it does not work.

This is the SQL query:

select null as arrayUserRolesIndex from dual

 

Any ideas?

 

Thanks,

Diana

 

Outcomes