cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Impactful Individual
Impactful Individual

Updating Task Custom Fields in Project Online

Hi All,

 

I'm building a flow to update Project Online Tasks via API.

 

I have managed to update standard fields on the task level with the help of this post https://powerusers.microsoft.com/t5/Connecting-To-Data/Update-Project-Online-Task/m-p/277934#M5274

 

Now I am trying to update custom fields at the task level but with no success.

 

My latest attempt looks something like this:

 

2019-07-17_1121_001.png

 

If anyone has any ideas would be much appreciated!

 

Thanks,

Sam

11 REPLIES 11
Highlighted
Helper IV
Helper IV

Re: Updating Task Custom Fields in Project Online

Hi @SamPo ,

 

Is there any error message available?

 

Highlighted
Impactful Individual
Impactful Individual

Re: Updating Task Custom Fields in Project Online

Hi,

 

With the help of a Microsoft engineer, we managed to get this working using a Process Query.

Will update will a full post on how we did it later, if anyone is interested in the meantime then feel free to message me privately.

 

Sam

Highlighted
Anonymous
Not applicable

Re: Updating Task Custom Fields in Project Online

Hello @SamPo,

 

I am trying to update simple(without lookup value) task custom field using flow as mentioned in this post but can`t update them.

 

Please advice on this how you succeeded with it.

 

Thanks and Regards .

Parth

Highlighted
Impactful Individual
Impactful Individual

Re: Updating Task Custom Fields in Project Online

I've had a few people contact me about this so adding all the info here.

 

If you want to update a custom field at the task level then you need to use a 'Process Query'

See the example below:

2019-08-27_1357.png

 

 

URL:

_vti_bin/client.svc/ProcessQuery

Headers:

{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "text/xml"
}

Body:

<?xml version="1.0" ?>
    <Request ApplicationName="Javascript Library" LibraryVersion="16.0.0.0" SchemaVersion="15.0.0.0" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
    <Actions>
        <Method Id="14" Name="SetCustomFieldValue" ObjectPathId="12">
            <Parameters>
                <Parameter Type="String">Custom_f8562da40598e911afb800155dd48834</Parameter>
                <Parameter Type="String">@{body('Create_a_work_item_-_feature')?['fields']?['System_Id']}</Parameter>
            </Parameters>
        </Method>
        <ObjectPath Id="16" ObjectPathId="15"/>
        <Query Id="17" ObjectPathId="15">
            <Query SelectAllProperties="true">
                <Properties/>
            </Query>
        </Query>
    </Actions>
    <ObjectPaths>
        <Constructor Id="0" TypeId="{3a609e5f-e2a1-497c-87a2-e5e8a781c096}"/>
        <Constructor Id="2" TypeId="{f256f605-bb33-4d62-b206-72a06a765075}">
            <Parameters>
                <Parameter ObjectPathId="0"/>
            </Parameters>
        </Constructor>
        <Property Id="4" Name="Projects" ParentId="0"/>
        <Method Id="6" Name="GetByGuid" ParentId="4">
            <Parameters>
                <Parameter Type="String">@{body('Parse_JSON')?['ProjectId']}</Parameter>
            </Parameters>
        </Method>
        <Property Id="8" Name="Draft" ParentId="6"/>
        <Property Id="10" Name="Tasks" ParentId="8"/>
        <Method Id="12" Name="GetByGuid" ParentId="10">
            <Parameters>
                <Parameter Type="String">@{items('Apply_to_each_-_create_and_update_features_in_TFS')?['TaskID']}</Parameter>
            </Parameters>
        </Method>
        <Method Id="15" Name="Update" ParentId="8"/>
    </ObjectPaths>
</Request>

 

Sam

 

Highlighted
Resolver I
Resolver I

Re: Updating Task Custom Fields in Project Online

Hello. Would you be okay with me asking a little more about how this works? I am trying to do the same thing with editing a custom task field. 

I tried using this but it doesn't work and I'm unsure as to what other fields I need to change. I have the custom field id, task id, project id, and custom field value done.

So for this part of the code I'm guessing this is where you put in the custom field id which I've already done:

<Parameter Type="String">Custom_f8562da40598e911afb800155dd48834</Parameter>

 And this part is where you put in whatever data you want to send to the custom field:

<Parameter Type="String">@{body('Create_a_work_item_-_feature')?['fields']?['System_Id']}</Parameter>

 I'm wondering if there are other things I need to change, like the "ObjectPathId", "ObjectPath Id", "Query Id" so they match up with what I need for my custom field?

<Actions>
        <Method Id="14" Name="SetCustomFieldValue" ObjectPathId="12">
            <Parameters>
                <Parameter Type="String">Custom_f8562da40598e911afb800155dd48834</Parameter>
                <Parameter Type="String">@{body('Create_a_work_item_-_feature')?['fields']?['System_Id']}</Parameter>
            </Parameters>
        </Method>
        <ObjectPath Id="16" ObjectPathId="15"/>
        <Query Id="17" ObjectPathId="15">
            <Query SelectAllProperties="true">
                <Properties/>
            </Query>
        </Query>
    </Actions>


Same here. Do I need to change the "Constructor Id"? And I can see that "TypeId" has something that looks like a guid or id of a field, so does this come from somewhere? Do I need to get some data from my custom field or anything and put that in here? As for "ParentId" do I need change that too?

<ObjectPaths>
        <Constructor Id="0" TypeId="{3a609e5f-e2a1-497c-87a2-e5e8a781c096}"/>
        <Constructor Id="2" TypeId="{f256f605-bb33-4d62-b206-72a06a765075}">
            <Parameters>
                <Parameter ObjectPathId="0"/>
            </Parameters>
        </Constructor>
        <Property Id="4" Name="Projects" ParentId="0"/>
        <Method Id="6" Name="GetByGuid" ParentId="4">
            <Parameters>
                <Parameter Type="String">@{body('Parse_JSON')?['ProjectId']}</Parameter>
            </Parameters>
        </Method>
        <Property Id="8" Name="Draft" ParentId="6"/>
        <Property Id="10" Name="Tasks" ParentId="8"/>
        <Method Id="12" Name="GetByGuid" ParentId="10">
            <Parameters>
                <Parameter Type="String">@{items('Apply_to_each_-_create_and_update_features_in_TFS')?['TaskID']}</Parameter>
            </Parameters>
        </Method>
        <Method Id="15" Name="Update" ParentId="8"/>
    </ObjectPaths>

 Overall I'm just wondering if I need to change things like "ParentId", "ObjectPathId", "Method Id", "Contructor Id" and "Type Id"? 

 

Thank you.

Highlighted
Impactful Individual
Impactful Individual

Re: Updating Task Custom Fields in Project Online

@Mgodby 

The only things you need to update are:

1) Custom field ID

2) Custom field value

3) Project ID

4) Task ID

 

I would suggest trying to hardcode all your values just to see if it's working.

All the other values should remain the same.

 

In general the way to get this code is to use the project desktop app and run a program like fiddler or wireshark to capture network traffic. Then make changes to a custom field and save and publish your project. You should then be able to find the process query in your network logs as this is actually how the app makes the changes back to the server.

 

Hope this helps

Highlighted
Resolver I
Resolver I

Re: Updating Task Custom Fields in Project Online

Thank you so for the help. Yeah I noticed that the id I put might've been wrong so I'll try to hardcode it and see what happens. 

Highlighted
New Member

Re: Updating Task Custom Fields in Project Online

I am trying too achieve similar thing.

 

Updating Project Custom Field (Text). I have just removed the "Task" section and followed the rest the same as suggested.

 

the flow is executed successfully, but the value is not updated in "Project Online Project Custom Field"

 

Can you advise me.

 

Thanks in advance

Highlighted
Regular Visitor

Re: Updating Task Custom Fields in Project Online

Hi @jacobsome I'm trying to do the exact same thing and seeing the same issue, did you ever work out how to update project custom fields?

Highlighted
New Member

Re: Updating Task Custom Fields in Project Online

Could not achieve using flow. So changed the approach.

Simple CSOM in azure function to incorporate business requirements.
Highlighted
New Member

Re: Updating Task Custom Fields in Project Online

@SamPo your method seems logical, but does not work at all.

Maybe Microsoft does not allow ProcessQuery anymore. 

I've tried many things to update task custom fields but nothing works.

And It's sad that Microsoft does not provide proper documentation.

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,386)