Adds success and error function on createTask