cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

What is proper syntax to PATCH to Custom Fields in Project Online

I am trying to create some logic to update Project Online custom fields based on information from a Financial Spreadsheet.

I have the logic working on getting the list of projects from Project Online and the values in an array from the Financial Spreadsheet.

Based on this logic, I'm able to locate the project, check it out, update the 'Description':'To New Description' using the .../Draft URI.

But I cannot figure out the syntax to update the Custom Fields using the /Draft/UpdateCustomFields.  The phase I'm at is just to pick one of my custom fields titled "_CER" with InternalName>Custom_c0d469448e88ea11afb500155de8e804 and just set it to '123456' or something simple (single line text field.)  When I update 'Description' the run takes about 3minutes but when I try different flavors of code to update the Custom Field it just hangs for 10-20 minutes and I cancel it.

Here is the section of flow where I need some assistance.  Admittedly I'm a Project Manager and not a developer so I tried to glean info from other posts including some work done by SamPO but I dont want task level Custom Fields, I want project level Custom Fields.  Thank you in advance.

 

Flow Diagram 4-27.png

 

XML for CER 4-27.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

UPDATED: What is proper syntax to PATCH to Custom Fields in Project Online

This ended up being very easy.  Thanks again to @SamPo who gave hints in his post to keep me going.  I did try fiddler and wireshark but my data was too encrypted to help me.

 

Ultimately the answer came from ghangus at this link: https://sharepoint.stackexchange.com/questions/116282/use-rest-odata-webservice-to-update-a-project-...  Scroll to the bottom and you will see some methods (?) updateTextProperty and updateGUIDproperty which I was able to get working.  I'm not done by any stretch but wanted to post what I have.

 

First, the URI I was able to get working was "_api/ProjectServer/WorkflowActivities/" and then added the updateTextProperty.

Three simple lines in the body projectId, propertyId, and value.  Notice the propertyId matches the Id of what I posted in the XML response in the original post for my custom field...no "Custom_"...and it wanted the dashes.  So make sure as you test you try it without the "Custom_" on those methods(?) first and use dashes.

 

Second, dont check out the project first.  Notice I removed that part of the flow.  I'm guessing the updateProperty entries have a built in check out of the project to make the changes.

 

Third, I went ahead and left the Check In Project part of my flow...but as I learn more and work on optimizing the overall flow it might be removed later.  I do not know if its needed at this time but again wanted to post this option out for others as soon as I had something working.

 

Last, it works with Project Online.  May not work on Project Server proper. 

 

Thanks to everyone out there who takes the time to help others.  I have spent hours combing through articles and answers from many different forums and I really appreciate those who help others.

Peace

BP

 

Update Text Property.png

 

View solution in original post

2 REPLIES 2
Highlighted
Frequent Visitor

UPDATED: What is proper syntax to PATCH to Custom Fields in Project Online

This ended up being very easy.  Thanks again to @SamPo who gave hints in his post to keep me going.  I did try fiddler and wireshark but my data was too encrypted to help me.

 

Ultimately the answer came from ghangus at this link: https://sharepoint.stackexchange.com/questions/116282/use-rest-odata-webservice-to-update-a-project-...  Scroll to the bottom and you will see some methods (?) updateTextProperty and updateGUIDproperty which I was able to get working.  I'm not done by any stretch but wanted to post what I have.

 

First, the URI I was able to get working was "_api/ProjectServer/WorkflowActivities/" and then added the updateTextProperty.

Three simple lines in the body projectId, propertyId, and value.  Notice the propertyId matches the Id of what I posted in the XML response in the original post for my custom field...no "Custom_"...and it wanted the dashes.  So make sure as you test you try it without the "Custom_" on those methods(?) first and use dashes.

 

Second, dont check out the project first.  Notice I removed that part of the flow.  I'm guessing the updateProperty entries have a built in check out of the project to make the changes.

 

Third, I went ahead and left the Check In Project part of my flow...but as I learn more and work on optimizing the overall flow it might be removed later.  I do not know if its needed at this time but again wanted to post this option out for others as soon as I had something working.

 

Last, it works with Project Online.  May not work on Project Server proper. 

 

Thanks to everyone out there who takes the time to help others.  I have spent hours combing through articles and answers from many different forums and I really appreciate those who help others.

Peace

BP

 

Update Text Property.png

 

View solution in original post

Highlighted
Community Support
Community Support

Re: UPDATED: What is proper syntax to PATCH to Custom Fields in Project Online

Hi,

 

I am glad you were able to figure out your issue here. I wanted to follow up here with a little more information on SharePoint Rest endpoints if you would like to learn more. Feel free to take a look.

 

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoin...

 

Regards,

 

Alex

 

-------

 

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (8,545)