none
project online task update using REST API RRS feed

  • Question

  • Hi,

    I am working on Project Online and want to update task[Assignment] / WorkHours using SharePoint workflow. Please guide how can i update task using REST API / Workflow.

    Thx 


    iffi

    Tuesday, August 8, 2017 3:12 PM

All replies

  • Have you got any solution on this?
    Thursday, December 20, 2018 12:20 PM
  • Hi,

    We used custom form for workhour submission and used following javascript on form submit. hope this help u out.

    thx

    function GetTasksToUpdate() {
            projContext = PS.ProjectContext.get_current();
            assignments = PS.EnterpriseResource.getSelf(projContext).get_assignments();
            projContext.load(assignments, 'Include(Project, Name, Id, Task, Work, ActualWork, ActualWorkMilliseconds, PercentComplete)');
            projContext.executeQueryAsync(function () { GetSelectedTask() }, onQueryFailed);
    }

    function GetSelectedTask() {
        console.log('GetSelectedTask');
        assignment = assignments.getByGuid($('#selectedTaskId').text());
        projContext.load(assignment);
        projContext.executeQueryAsync(UpdateSelectedTask, onQueryFailed);
    }

    function UpdateSelectedTask() {
        console.log('UpdateSelectedTask: ' + assignment.get_name());
        var actualWorkHours = parseFloat(assignment.get_actualWork());
        var diff = endTime - startTime;
        currentWorkHours = parseFloat(diff / 3600000);
        console.log('currentWorkHours: ' + currentWorkHours);
        actualWorkHours = actualWorkHours + currentWorkHours;
        assignment.set_actualWork(actualWorkHours + 'h');
        assignment.submitStatusUpdates('');
        projContext.executeQueryAsync(SelectedTaskUpdated, onQueryFailed);
    }

    function SelectedTaskUpdated() {
        console.log('Task updated.');
    }

    iffi

    Monday, December 24, 2018 7:38 AM