Skip to main content

Notifications

Power Automate - Using Connectors
Answered

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

(0) ShareShare
ReportReport
Posted on by

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

  • cwalter2 Profile Picture
    cwalter2 2 on at
    Re: What is proper syntax to PATCH to Custom Fields in Project Online

    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?

  • cwesley Profile Picture
    cwesley 7 on at
    Re: UPDATED: What is proper syntax to PATCH to Custom Fields in Project Online

    @alrez @Anonymous  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!  

  • alrezac Profile Picture
    alrezac on at
    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-sharepoint-rest-endpoints

     

    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.

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

    This ended up being very easy.  Thanks again to @Anonymous 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-in-project-server  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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard

Featured topics