restattask

How do I Set the Planned Completion Date on a Task?


I'm trying to figure out how to set the planned completion date when creating or updating a task. Tasks always result with a plannedCompletionDate equal to the day the project was created.

I have used a few different dateTime formats, but it never changes. These are the two I've used that didn't throw an error:

2015-05-02T08:00:00:000-0500
2015-05-02

However, even though there was no error, there was no change either.

I saw in another post that a user was using $$TODAY-25d in a search query, so I thought I'd try that, but I still got the error

Date format does not match a recognized date format

The project containing the task has a status of 'IDEA'. I'm not sure if this affects being able to set the plannedCompletionDate of the task via the API or not, so I thought I'd mention it just in case.


Solution

  • The date format you are using is correct, but you need to remember that all the rules of the timeline engine also apply to the APIs. This means that predecessors and task constraints affect the dates on the tasks. If you would like to pin the task to a certain date you would need to use a FIXT, MSO, or MFO taskConstraint.

    /api/task/abc123?method=POST&sessionID=abc123&plannedCompletionDate=2015-05-02T08:00:00:000-0500&taskConstraint=MFO...
    

    It a way, you have been setting the date, hence it doesn't throw an error, but the project then recalculates the timeline and changes it right back to what it was before. The taskConstraint will force it to follow the date you put in.