1

I am trying to find out what triggers new tasks added in AtTask to show up in a users MyWork queue. Here is the code I am using to post a new task to a project, but I still have to access the task on my browser to move it to my active work queue. I have tried to manually run a diff of the task fields for both the pre and post selection. Here is the code I am using to generate the new task:

$taskName = "Test..1";
$attask_newtask_url = 'https://foo.attask-ondemand.com/attask/api/v4.0/task';

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $attask_newtask_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
    'name'=>$taskName,
    'projectID'=>$projID,
    'sessionID'=>$sessionID,
    'assignedToID'=>$userID,
    'plannedStartDate'=>"02/10/2015 10:00",
    'plannedCompletionDate'=>"2/15/2015 14:00" ,
    'taskConstraint'=>"FIXT",
    'commitDate'=>"2/15/2015 14:00",
    'condition'=>"0"
)));
$attask_newtask_json = curl_exec($ch);
curl_close($ch);

This code will create a new task in the indicated project, but the MyWork does not show the tasks.

Any suggestions? Thanks

Liam
  • 27,717
  • 28
  • 128
  • 190
Ben D. S.
  • 35
  • 6
  • Is the project in current mode? If it isn't in current then the task wouldn't show in the users queue. Also, not sure if it will actually take your commit date like that. Some fields require you to be logged in as the user to update. For example, you cannot write a note as a different user. There is an easy work around where you use a combo of the API key and the users e-mail to temp login as them, get a session ID and then make the change. Shouldn't affect you here as you probably don't actually need to set the commit date. – Craig Sep 03 '15 at 00:08
  • Hi Craig, Thanks for the response. I actually logged in earlier in the code and store the session id in the $sessionID variable. I then send the sessionID as part of CURL request. This request actually works and creates a task for the user defined in $userID variable. I took a look at the commit date after I created the task and it looks ok, but it just does not move it into a work task. When I look at the task in the browser it still says "You have been assigned to work on this." and then gives me an option to click on "Work on This" (https://goo.gl/viByrf for an example.) Any other thoughts? – Ben D. S. Sep 03 '15 at 03:17
  • Are you saying that the task doesn't show up in Work Requests either, or are you trying to get it to drop directly into the Working On tab? If it is the latter then Michael has your answer. – Craig Sep 03 '15 at 22:05

1 Answers1

0

You move this by using the following

PUT attask/api/task/xxxxx?action=acceptWork

so try adding the following to the code

'action'=>"acceptWork" 
michael johnson
  • 757
  • 1
  • 4
  • 10
  • Perfect. That was exactly what I needed. I had to run it as two separate actions, but it worked perfectly. – Ben D. S. Sep 04 '15 at 00:17