1

Hello I found this article: Updating Project Server custom fields via JSOM. This article explain about how to update custom field value in Project.

In my case, I am trying to update custom field value in Tasks. But, I got an error :

PS_DraftTask has no method 'setCustomFieldValue'

Can we update custom field in Tasks? I have managed update some value like Name which is standard field in Tasks. My code not to different with the article, but if you want to see it, let me know.

Thanks a lot.

1

I'm copying my answer from here: https://stackoverflow.com/questions/25853398/updating-task-level-custom-fields/39325738#39325738

JSOM example to update task custom field:

var projContext = PS.ProjectContext.get_current();    
var projects = projContext.get_projects();
var project = projects.getByGuid(projUid).get_draft();
var tasks = project.get_tasks();

var task = tasks.getByGuid(taskUid);

task.set_item(cfIntName, newValue);

var queueJob = project.update();

projContext.waitForQueueAsync(queueJob, 60, 
    Function.createDelegate(this, function(res) {
        // Publish project here
    }), function(error) {

    console.error(error);        
}); 

That should be complete (though I pulled it from a script, so check the success / failure handlers which I truncated).

HTH,

0

I got some clue in this : Use CSOM to update project's custom fields

Actually, there's task level code at the bottom of that post.

  • but in JSOM not work at all :( – andrefadila Nov 11 '14 at 3:50
0

You can update custom field value using this link http://projectservercode.com/tag/how-to-update-custom-field-using-csom/

  • Can you please add details from the link which you have provided? Only links will not help. – Asad Refai Apr 20 '16 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.