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

How to update project custom fields with REST?

$
0
0

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.



Viewing all articles
Browse latest Browse all 5347

Trending Articles



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