none
How to update project custom fields with REST? RRS feed

  • General discussion

  • The following gives an error of "Custom_<guid> does not exist on type PS.DraftProject". Any thoughts? (If I change "Custom_<guid>" to Name, the code successfully updates the project name, so the rest seems to be working)

    var strUrl = "http://server/pwa/_api/ProjectServer/Projects('ProjectGUID')/Draft/includeCustomFields";
    
    $.ajax({
      url: strUrl,
      type: "POST",
      contentType: "application/json;odata=verbose",
      data: JSON.stringify(
      {
        '__metadata': {
         'type': 'PS.DraftProject'
      },
      'Custom_<guid>': "Abcd"
      }),
     headers: {
     "accept": "application/json;odata=verbose",
     "X-RequestDigest": strDigest,
     "X-HTTP-Method":"MERGE"
     },
     success: function () {
     alert('success!');
     },
     error: function (err) {
       alert(JSON.stringify(err));
      }
     });

    EDIT: I realized that there is a CSOM function "setCustomFieldValue", so I tried posting to

    "/pwa/_api/ProjectServer/Projects('projectGuid')/Draft/SetCustomFieldValue", but received the following:

    "The method SetCustomFieldValue cannot be invoked as its parameter value is not supported."

    I hope this doesn't mean what it suggests. Is the REST interface not capable of updating custom fields? 


    Mike G.


    • Edited by m g Tuesday, May 13, 2014 8:29 PM
    Tuesday, May 13, 2014 7:30 PM

All replies