Javascript to Re-Assign a Task in IBM BPM
This is a quick one (and most people probably know it already). It's been a busy couple of weeks...
Oftentimes, when testing processes in the development environment, you will need to use a series of user accounts to run different tasks. In an ideal world there will be test accounts that you can use (and the IDE will conveniently store the passwords for you) or you will just be able to use your own account to run any task.
However, sometimes test accounts aren't permitted by an organisation and sometimes processes are modeled in such a way that process flow is impacted by group membership (so you can't really be in all groups).
In these cases you can run a command like this in the in the Expression Evaluator to quickly re-assign a Task so that you can run it...
Oftentimes, when testing processes in the development environment, you will need to use a series of user accounts to run different tasks. In an ideal world there will be test accounts that you can use (and the IDE will conveniently store the passwords for you) or you will just be able to use your own account to run any task.
However, sometimes test accounts aren't permitted by an organisation and sometimes processes are modeled in such a way that process flow is impacted by group membership (so you can't really be in all groups).
In these cases you can run a command like this in the in the Expression Evaluator to quickly re-assign a Task so that you can run it...
tw.system.reassignTask(12345, "USER:jsmith");
The Task ID (12345) can be read from the Task ID column in the Process Inspector and the User should be a value that would work with Custom Routing.
UPDATE (03.09.2106): In newer versions you can do the same thing with...
tw.system.findTaskByID(12345).reassignTo("jsmith");