Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

PS.EnterpriseResourceCollection.update() returns undefined

$
0
0

I'm trying to update the collection of enterprise resources in the Project Web App instance using JSOM, but .update() method returns undefined.
I was originally trying to add a calendar exception to a specific resource, but I've removed all this and I'm just trying to update the collection now. Same error. 
Here's my code:

    // Initialize the current client context.
    projContext = PS.ProjectContext.get_current();

    // Get the collection of enterprise resources.
    resources = projContext.get_enterpriseResources();

    // Register the request for information that you want to run on the server.
    projContext.load(resources, "Include(Id, Name, ResourceCalendarExceptions, IsGeneric)");

    // Run the request on the server.
    projContext.executeQueryAsync(UpdateResources, QueryFailed);

    function UpdateResources(response)
    {
        // Submit the request to update the collection on the server
        var updateJob = resources.update(); // returns undefined! <------------------
        projContext.waitForQueueAsync(updateJob, 10, IterateThroughResources);
    }

Another example:

function UpdateProjects()
{
// Get the projects collection.
projects = projContext.get_projects();

// Submit the request to update the collection on the server
var updateJob = projects.update(); <--------------- THIS CODE WORKS!
projContext.waitForQueueAsync(updateJob, timeoutSeconds, QueueJobSent);
}

function UpdateResources()
{
// Get the projects collection.
resources = projContext.get_enterpriseResources();

// Submit the request to update the collection on the server
var updateJob = resources.update(); <---------------------- THIS RETURNS UNDEFINED!
projContext.waitForQueueAsync(updateJob, timeoutSeconds, QueueJobSent);
}

Any idea why this might be?


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>