Topic
  • 11 replies
  • Latest Post - ‏2013-07-31T21:37:24Z by A.A.A
SystemAdmin
SystemAdmin
7615 Posts

Pinned topic Re-assign Task to another user

‏2013-02-01T11:04:35Z |
Hi,
I am using BPM 8.0.
I have a requirement to provide access to specific group of person who can re-assign tasks to any person in the organization.

This group will act as a process owners and should be authorized to re-assign task from one user to another user.

I have tried REST, JS API. However, I could not achieve the same for task which are not assigned to me.

Thanks in advance,
Updated on 2013-02-18T17:29:09Z at 2013-02-18T17:29:09Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-01T16:55:44Z  
    The REST API will not allow this, certainly, but the JSAPI should. What did you actually try with the JS API?

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re-assign Task to another user

    ‏2013-02-02T06:09:32Z  
    The REST API will not allow this, certainly, but the JSAPI should. What did you actually try with the JS API?

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
    Hi,
    I have tried this out and it seems to serve the purpose.

    Create an Integration service, say Reassign Task.
    Write Script:

    tw.system.findTaskByID({TaskID String|Integer}).reassignTo(tw.system.org.findUserByName({UserName});

    Here, UserName is the tw.system.user.name for different users.

    The task gets reassigned to the specified User.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-12T07:37:31Z  
    Hi,
    I have tried this out and it seems to serve the purpose.

    Create an Integration service, say Reassign Task.
    Write Script:

    tw.system.findTaskByID({TaskID String|Integer}).reassignTo(tw.system.org.findUserByName({UserName});

    Here, UserName is the tw.system.user.name for different users.

    The task gets reassigned to the specified User.
    Ananya,

    Even I've have same requirement to reassign task to another user for which the current loggedIn user is not task owner. I'll try the JS API mentioned above. But at the same time, I would like to know how did you fetch the task list for the process owner group in which all the other user's task appear?? Please help on the same.

    P.S We do use currently REST API to fetch loggedIn user's task and use seperate UI web app instead of coach.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-12T16:07:02Z  
    Ananya,

    Even I've have same requirement to reassign task to another user for which the current loggedIn user is not task owner. I'll try the JS API mentioned above. But at the same time, I would like to know how did you fetch the task list for the process owner group in which all the other user's task appear?? Please help on the same.

    P.S We do use currently REST API to fetch loggedIn user's task and use seperate UI web app instead of coach.
    If you need to reassign a task, how would it be that you wouldn't know the task ID of the task you need to reassign?

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-12T23:12:30Z  
    If you need to reassign a task, how would it be that you wouldn't know the task ID of the task you need to reassign?

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
    Andrew - Your'e right. I think I have to explain little more on requirement. The requirement is related to getting the team member's task list using REST API when a manager user log's in ( its from custom java web app and not BPM portal).

    Currently we are retriving the task list of a loggedIn user using the following REST API

    search/query?columns={cols}&condition={status}&condition={bpdName}&organization=byTask

    Columns include task Id, activity name etc.,

    There are two questions here

    1. How do I relate manager user and its team members in BPM? Currently the groups are defined only for business role say Sales, Marketing etc. And these groups are inturn linked as Participant group in the Swimlane of the process. All the users and groups are derived from custom User Registry.

    2. How do I get the team member's task list when manager log's in using REST API? Upon retrieving the task list, as you mentioned we can invoke integration service which will reassign task by passing the task Id and user Id.
    P.S I'm using BPM 751 standard.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re-assign Task to another user

    ‏2013-02-13T06:16:32Z  
    Andrew - Your'e right. I think I have to explain little more on requirement. The requirement is related to getting the team member's task list using REST API when a manager user log's in ( its from custom java web app and not BPM portal).

    Currently we are retriving the task list of a loggedIn user using the following REST API

    search/query?columns={cols}&condition={status}&condition={bpdName}&organization=byTask

    Columns include task Id, activity name etc.,

    There are two questions here

    1. How do I relate manager user and its team members in BPM? Currently the groups are defined only for business role say Sales, Marketing etc. And these groups are inturn linked as Participant group in the Swimlane of the process. All the users and groups are derived from custom User Registry.

    2. How do I get the team member's task list when manager log's in using REST API? Upon retrieving the task list, as you mentioned we can invoke integration service which will reassign task by passing the task Id and user Id.
    P.S I'm using BPM 751 standard.
    In my case, I have used the Search API to return a list of the Tasks i.e Task Name, ID etc. that is AssignedTo the required user.

    var search = new TWSearch();
    search.organizedBy = "Task";
    var searchColumnList = new Array();
    var conditionList = new Array();
    //
    // Task - ID
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "ID";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);

    //This part returns tasks assigned to a specific user, here assignFrom is a local variable which contains the required userID
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "AssignedToUser";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);

    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = tw.local.assignFrom;
    conditionList.push(condition);

    /
    //
    // Task - Status
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "Status";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);
    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = "Received";
    conditionList.push(condition);

    conditionList.push(condition);

    /
    // Process - Name
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "Name";
    searchColumn.type = TWSearchColumn.Types.Process;
    searchColumnList.push(searchColumn);

    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = "TItest"
    conditionList.push(condition);

    search.columns = searchColumnList;
    search.conditions = conditionList;

    var results = search.execute();
    var rows = new tw.object.listOf.taskdata();
    for (var i = 0; i<results.rows.length; i++) {
    // log.info(results.rows[i].getTypeName());
    var newRow = new tw.object.taskdata();
    var values = results.rows[i].values;
    for (var j=0; j<values.length; j++) {
    // Build the column name for the search
    var key;
    if (searchColumnList[j].type == TWSearchColumn.Types.BusinessData) {
    //log.info("Business Data : " + searchColumnList[j].name);
    var keylst = searchColumnList[j].name.split("@");
    key = keylst[0];
    } else {
    key = searchColumnList[j].type + "_" + searchColumnList[j].name;
    }
    log.info("Key: " + key + ":" + values[j]);
    // The following is an associative assignment. The data type of newRow is an object with fixed fields.
    // Key is used to set which of the fields to set.
    newRowkey = String(values[j]);
    }
    rowshttp://rows.listLength = newRow;
    }
    tw.local.rows = rows;
    log.info(results.rows);

    where taskdata is a Business Object, which contains attributes corresponding to the required data. I have retrieved the list of Task ID's assigned to the particular user in this way.

    I have then called the Integration service from a Human service, which causes the required Task ID (where task Status should be Received) to be re-assigned to the required user.
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-13T16:42:30Z  
    In my case, I have used the Search API to return a list of the Tasks i.e Task Name, ID etc. that is AssignedTo the required user.

    var search = new TWSearch();
    search.organizedBy = "Task";
    var searchColumnList = new Array();
    var conditionList = new Array();
    //
    // Task - ID
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "ID";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);

    //This part returns tasks assigned to a specific user, here assignFrom is a local variable which contains the required userID
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "AssignedToUser";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);

    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = tw.local.assignFrom;
    conditionList.push(condition);

    /
    //
    // Task - Status
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "Status";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);
    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = "Received";
    conditionList.push(condition);

    conditionList.push(condition);

    /
    // Process - Name
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "Name";
    searchColumn.type = TWSearchColumn.Types.Process;
    searchColumnList.push(searchColumn);

    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = "TItest"
    conditionList.push(condition);

    search.columns = searchColumnList;
    search.conditions = conditionList;

    var results = search.execute();
    var rows = new tw.object.listOf.taskdata();
    for (var i = 0; i<results.rows.length; i++) {
    // log.info(results.rows[i].getTypeName());
    var newRow = new tw.object.taskdata();
    var values = results.rows[i].values;
    for (var j=0; j<values.length; j++) {
    // Build the column name for the search
    var key;
    if (searchColumnList[j].type == TWSearchColumn.Types.BusinessData) {
    //log.info("Business Data : " + searchColumnList[j].name);
    var keylst = searchColumnList[j].name.split("@");
    key = keylst[0];
    } else {
    key = searchColumnList[j].type + "_" + searchColumnList[j].name;
    }
    log.info("Key: " + key + ":" + values[j]);
    // The following is an associative assignment. The data type of newRow is an object with fixed fields.
    // Key is used to set which of the fields to set.
    newRowkey = String(values[j]);
    }
    rowshttp://rows.listLength = newRow;
    }
    tw.local.rows = rows;
    log.info(results.rows);

    where taskdata is a Business Object, which contains attributes corresponding to the required data. I have retrieved the list of Task ID's assigned to the particular user in this way.

    I have then called the Integration service from a Human service, which causes the required Task ID (where task Status should be Received) to be re-assigned to the required user.
    To Ananya's point, the REST API isn't capable of showing you other peoples tasks (even if you manage them) because some companies would view that as a security hole since anyone with a web browser can make a REST API call, and in some situations a manager is not permitted to see some (all?) of their team's tasks.

    The JS API allows you to choose to ignore this. So if you want a manager to be able to see all the team's tasks, then you simply create a service that can return that data and make it available as a URL or a Web Service so that it can be called.

    Now the bigger question here is the "How do I know who is on Person X's team". That isn't a problem that IBM BPM really solves for you out of the box. The security groups have the ability to say Group X contains the managers of Group Y, but those groups are at a global level, not a process level, and generally you wind up with the situation where there are 200 call center reps, all in the call center group and 10 call center managers, all in the call center manager group, but each manager only manages 20 reps and the groups don't capture that relationship.

    The point here is that a system needs to exist or be created where that relationship can be looked up. It can be done in a DB, it can be done in LDAP, but someone has to create it and make it accessible. IBM BPM today does not solve that problem. (You can use user attributes to make it easier to solve, but there is no OOTB solution)

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-18T14:57:53Z  
    In my case, I have used the Search API to return a list of the Tasks i.e Task Name, ID etc. that is AssignedTo the required user.

    var search = new TWSearch();
    search.organizedBy = "Task";
    var searchColumnList = new Array();
    var conditionList = new Array();
    //
    // Task - ID
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "ID";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);

    //This part returns tasks assigned to a specific user, here assignFrom is a local variable which contains the required userID
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "AssignedToUser";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);

    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = tw.local.assignFrom;
    conditionList.push(condition);

    /
    //
    // Task - Status
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "Status";
    searchColumn.type = TWSearchColumn.Types.Task;
    searchColumnList.push(searchColumn);
    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = "Received";
    conditionList.push(condition);

    conditionList.push(condition);

    /
    // Process - Name
    //
    var searchColumn = new TWSearchColumn();
    searchColumn.name = "Name";
    searchColumn.type = TWSearchColumn.Types.Process;
    searchColumnList.push(searchColumn);

    var condition = new TWSearchCondition();
    condition.column = searchColumn;
    condition.operator = "Equals"
    condition.value = "TItest"
    conditionList.push(condition);

    search.columns = searchColumnList;
    search.conditions = conditionList;

    var results = search.execute();
    var rows = new tw.object.listOf.taskdata();
    for (var i = 0; i<results.rows.length; i++) {
    // log.info(results.rows[i].getTypeName());
    var newRow = new tw.object.taskdata();
    var values = results.rows[i].values;
    for (var j=0; j<values.length; j++) {
    // Build the column name for the search
    var key;
    if (searchColumnList[j].type == TWSearchColumn.Types.BusinessData) {
    //log.info("Business Data : " + searchColumnList[j].name);
    var keylst = searchColumnList[j].name.split("@");
    key = keylst[0];
    } else {
    key = searchColumnList[j].type + "_" + searchColumnList[j].name;
    }
    log.info("Key: " + key + ":" + values[j]);
    // The following is an associative assignment. The data type of newRow is an object with fixed fields.
    // Key is used to set which of the fields to set.
    newRowkey = String(values[j]);
    }
    rowshttp://rows.listLength = newRow;
    }
    tw.local.rows = rows;
    log.info(results.rows);

    where taskdata is a Business Object, which contains attributes corresponding to the required data. I have retrieved the list of Task ID's assigned to the particular user in this way.

    I have then called the Integration service from a Human service, which causes the required Task ID (where task Status should be Received) to be re-assigned to the required user.
    Thanks Ananya / Andrew for your response and its really a useful info.

    Ananya, Just one last question - I understand your Script but want to know from where this script gets triggered? Is this executed as part of Human Task (Coach) and displaying the task Ids in UI or using it as one another service?

    Andrew & Ananya,

    The requirement is to display manager's team task list from a seperate java ui web application. In which user will select a task to reassign to one another user.

    Currently my implementation plan is to pass all the team member's userId when a manager user logs in from java web app. This Java app consume WS defined as part of BPM Process by passing user Ids and BPM WS returns the task list as result (leveraging the JS API similar to Ananya's one within the WS). Upon display of task list in UI, user will be allowed to select a task and reassign to another user by calling the said "Reassign" Integration service using task Id and user Id as parameter.

    Is this approach work or any other suggestions for my scenario? (Sorry for lot of questions as I'm still beginner on BPM end)
    Regards,
    Amarnath
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Re-assign Task to another user

    ‏2013-02-18T17:29:09Z  
    Thanks Ananya / Andrew for your response and its really a useful info.

    Ananya, Just one last question - I understand your Script but want to know from where this script gets triggered? Is this executed as part of Human Task (Coach) and displaying the task Ids in UI or using it as one another service?

    Andrew & Ananya,

    The requirement is to display manager's team task list from a seperate java ui web application. In which user will select a task to reassign to one another user.

    Currently my implementation plan is to pass all the team member's userId when a manager user logs in from java web app. This Java app consume WS defined as part of BPM Process by passing user Ids and BPM WS returns the task list as result (leveraging the JS API similar to Ananya's one within the WS). Upon display of task list in UI, user will be allowed to select a task and reassign to another user by calling the said "Reassign" Integration service using task Id and user Id as parameter.

    Is this approach work or any other suggestions for my scenario? (Sorry for lot of questions as I'm still beginner on BPM end)
    Regards,
    Amarnath
    That approach sounds correct to me.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • RanieriMazili
    RanieriMazili
    98 Posts

    Re: Re-assign Task to another user

    ‏2013-07-30T20:06:53Z  
    That approach sounds correct to me.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com

    I could see in the source code the column names like "AssignedToUser" and "Name"... how did you figure out the column names? Is there a documentation of this list?

  • A.A.A
    A.A.A
    29 Posts

    Re: Re-assign Task to another user

    ‏2013-07-31T21:37:24Z  

    I could see in the source code the column names like "AssignedToUser" and "Name"... how did you figure out the column names? Is there a documentation of this list?

    These already exist within the object. For instance:

    searchColumn.name = "AssignedToUser"

    is the same as

    searchColumn.name = TWSearchColumn.TaskColumns.AssignedToUser