Expand my Community achievements bar.

Creating Tasks Via API

Avatar

Level 10
Hi, We are trying to build an integration with our PTO Tracker where requests in that tool or tasks in project. We have figured out how to create the tasks and to set the date range, but we cannot get the Planned Hours to work correctly. We have tried different duration types and task constraints and it never seems to come out correctly. We are working with support but I was curious if anyone here has an API that does tasks inside a project and how they are doing planned hours in that. Thank you! Anthony Imgrund FCB
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

11 Replies

Avatar

Level 10
Hi Anthony, We create tasks in a project via the API but we typically use a template which has the Planned Hours in it. Did you try messing with the Duration Type? This typically exposes the Planned Hours when set to Calculated Assignment. Vic Alejandro, PMP, CSM | IT Program Manager Denver Water | t: (303-628-7262) | c: (303-319-6473) "http://www.denverwater.org/"> http://www.denverwater.org INTEGRITY | VISION | PASSION | EXCELLENCE | RESPECT

Avatar

Level 3
I am having the exact same issue. I can set the dates to be fixed - taskConstraint = FIXT as you do, but in my experience no matter what durationType I use and no matter how I attempt to 'load' the hours - duration, plannedDuration, durationMinutes, units, etc, the hours don't 'stick' and the system calculates the Planned Hours to be something 'else' In my testing I created a record and then read it back to see how the system 'stored' the duration and for a 1 day long event with durationType set to A, that starts at the same time the user starts, and ends at the same time the users work day ends, no matter what I input as duration during the creation comes back as duration = .75 or worse yet 0 (other duration types). Really annoying I may try Vic's method and append a template that has a single task as a means to get around this....... Jim Brown FujiFilm Medical Systems, USA

Avatar

Level 10
I've done some testing and got part of the way there. We normally use 'Simple' for our duration type (this is the default in the system settings). When you add a task via the Workfront UI it uses Simple. However, when I add a Task via the API it uses Calculated Work. Whilst it has this duration type, I can't set planned hours via the UI or the API. So, I changed my POST query to include durationType=S. The creates the task with the correct duration type. I can then edit the planned hours via the UI, but I still can't do it via the API, no matter what I try. I tried splitting it into 2 queries: POST to create the task with durationType=S PUT to update the task with duration and planned hours - including for example duration=0.25&durationMinutes=120&durationUnit=D&work=2&workRequired=120 Hoping someone else can advise the missing bit of info so we can set planned hours via the API. Regards, David Cornwell

Avatar

Level 10
HI David, I'm off grid, but suggest you push with S via the API, do a full GET on the item with fields=*, manually adjust it to your liking via the UI, do another full GET on the item with fields=*, then meticulously compare the two GET results for some other ahh-that-might-be-it difference(s), then try again via the API and that new knowledge. "API self-teaching: it might be painful, but at least it’s slow." Wait. What? Regards, Doug Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads

Avatar

Level 3
David/Doug - I have done some testing reading the values stored in the task, making changes in the GUI - reading the task again and then mimicking the changes with the API to no avail....the 'inserted/posted values just do not seem to take..... Jim Brown FujiFilm Medical Systems, USA

Avatar

Level 3
"API self-teaching: it might be painful, but at least it's slow." That should be the title of the API Explorer page! Randy Roberts ZPA - Zimmerman Advertising LLC

Avatar

Level 10
Hi Jim and Doug - I actually did that comparison of UI changes the other day, also to no avail. David Cornwell

Avatar

Level 10
Hmm... Is it possible that the API version makes a difference (e.g. try api-unsupported)? Regards, Doug Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads

Avatar

Level 1
Hello All- I am about to embark on a project where I need to create tasks and hours on tasks via API, so I was wondering if anyone was successful with this? Kathryn Alexander Bose Automotive

Avatar

Level 10
Hi Kathryn, Yes, we've done lots of this - mainly using Fusion, but also via some other systems. What platform will you be using? What are your goals of the project? Depending on what you're using/doing I'm happy to give some tips. Regards, David David Cornwell

Avatar

Level 2

Hey Folks,

 

Placing this comment here in case others run into this issue.  Workfront Support was able to assist and indicated the following:

"So on the backend of WF there is a little setting called "Worked Locked" that essentially acts to manage recalculation of planned hours with different task settings.
When you are updating the "Work" field through fusion, you need to also pass the "Worked Locked" as "Yes" in order for that to take effect as otherwise the work/planned hours is in a do not edit state."

 

The technical name of the field is "isWorkRequiredLocked" if you cannot find it in Fusion.  Much thanks to Workfront Support - hope this helps you all.


Cheers,


Eamon