<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Task for every user with a specific Role (dynamically)</title><link>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically</link><description>&lt;p&gt;Is it possible to create a task which has to be completed by every user of a specific role, which should be determined dynamically? I.e. if I have three users which own a role, all three users have to complete this task. The more convinient way would be, if all three get an own task in ther "Personal Task List".&lt;/p&gt;
&lt;p&gt;Thanks in advance for any answers.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 13 Jan 2016 10:49:08 -0500</lastBuildDate><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically#1627</link><description>&lt;p&gt;you are right, a list of ISession is not serializable. So you must store the name of the users as this is only a simple String serialization.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 13 Jan 2016 10:49:08 -0500</pubDate><guid>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically#1627</guid></item><item><title>Comment by rhorber on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically#1626</link><description>&lt;p&gt;Thank you for your answer, it works. But I had to save the names in a separate list and work with that list. The list with the users contains null after the task switch gateway.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rhorber</dc:creator><pubDate>Mon, 11 Jan 2016 14:58:48 -0500</pubDate><guid>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically#1626</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically/1624</link><description>&lt;p&gt;You can query the users of a role with the following public API:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ivy.wf.getSecurityContext().findRole("Everybody").getAllUsers();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can draw a process that loops over a task switch and creates new user tasks until all users have one. 
The second task is a system task which continuous the execution until the list of users is empty.&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="http://answers.axonivy.com/upfiles/createTaskForEachUser.png"&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Fri, 08 Jan 2016 15:01:07 -0500</pubDate><guid>https://answers.axonivy.com/questions/1621/task-for-every-user-with-a-specific-role-dynamically/1624</guid></item></channel></rss>