cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BillPricePMP
Helper I
Helper I

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
BillPricePMP
Helper I
Helper I

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

4 REPLIES 4
BillPricePMP
Helper I
Helper I

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

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.

cwesley
Frequent Visitor

@alrez @BillPricePMP  what logic can be used if the project is checked out in an other session or by other user? the Send HTTP Request action would fail in this case.... do you have any suggestions?  

 

In Project Server workflow there are events like When a Project is Checked In... can this be done in flows? Basically wait for the project to be checked in and then update the fields.

 

Thank you so much for this post... I was finally able to write data into project online using flow!  

cwalter2
New Member

I have had some difficulty getting this to work.

Here is what I have and the result:

Capture.PNG
After messing around a bit I noticed that when I go to the project detail page the text is updated but in the project center it does not show up. I have to manually go in and edit and save for it to show up. Any suggestions?

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (44,534)