Hi.
In my PowerApp using the standard connector I can update the Task Title of the current record in the Gallery eg
onChange = Planner.UpdateTaskV2(id,{title:TaskTitle.Text})
ie in the onChange event handler of the Text component called "TaskTitle", call the Planner connector method UpdateTaskV2(id,{title:TaskTitle.Text}) and yes, the Task Title updates in Planner. Same for updating the dueDateTime:
Planner.UpdateTaskV2(id,{dueDateTime:dueDate})
So far so good. Now, what I also want to do is update the bucketId to move a Task record from one bucket in the plan to another which the standard connector does not allow. So, I need to make a Custom Connector (CC).
I made a CC called PlannerCustomConnector (imaginative, I know!) with a bunch of GETs and all works well. eg for a Gallery Items collection:
PlannerCustomConnector.ListBucketTasks("myBucketIdGoesHere").value
To change the bucketId on a Task I need to use PATCH with an If-Match of the most recent etag from the Task. Testing that in MSGraph works to shift the Task record from one bucket to another eg:
PATCH https://graph.microsoft.com/v1.0/planner/tasks/myTaskIdHere
Request header If-Match : W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBESCc="
Request body: { "bucketId":"theTargetBucketIdInThisPlanGoesHere" }
where that If-Match was copied from the etag of the most recent GET of that same task. So, that much works.
Now, what I cannot work out is how to define the PATCH request in the PowerApps Custom Connector builder so I can set the If-Match request header property. I can get the etag data from ThisItem in the app, of course, but how to define the request in the Connector so I can set the request header property with that value? Or so it will do it for me even?
I used the Postman => Export => import to PowerApps Connector method for all my other requests and have a definition item for my UpdateTask request in the PowerApps Connector builder but what value do I put in the Request Header CC definition for the If-Match key??
This is the last hurdle preventing me from finishing my custom Planner app. Well, I hope it is the last hurdle anyway - I have said that about 10 times so far in this project! So many Gotchas!
Thanks,
Murray
Solved! Go to Solution.
Sorry for the delay getting back. I now have this working.
So, in addition to the helpful info above there was another request header that was required to make this useful in an app and which is not mentioned in the docs. 😞
Here are the steps to define an action called UpdateTask:
1. This blog post outlines setting up the Azure App permissions etc so your custom connector can authenticate on behalf of the user who is using it (ie you, for now).
Follow that pattern to delegate permissions, generate the secret key, etc. That blog post example requires Directory and Group permissions. For Planner you will also need to delegate permissions for Tasks eg Tasks.ReadWrite (and possibly others depending on what you want your custom connector to be able to do).
2. In the Generate Swagger file section, when using Postman, add API calls for the various Planner calls you want to include in your connector. In terms of this example, we will want one for at least GetTask and UpdateTask
GET https://graph.microsoft.com/v1.0/planner/tasks/:taskid
PATCH https://graph.microsoft.com/v1.0/planner/tasks/:taskid
Note that with some extra work you can use Postman to test your calls, that is not necessary here. All we are doing is defining the API calls we want to build into our custom connector so Postman will build the JSON definition file for us. So, add your calls and continue down to Export your collection of API calls.
3. Follow the instructions in the Create your custom connector section of the blog post.
Build the action for GetTask() first. It is simple and you can use it to make sure all is working before going on to define the UpdateTask() action. Note that in the blog post Todd is using the connector Test tab to get the template JSON to continue with the definition (step 20 or so). In practice, I found it easier to have the Graph Explorer open in another browser window and use it to run the calls in order to get the template / sample response JSON we need for the connector definition.
Once you have built and saved the GetTask() action you can test it to make sure you are on track so far. If you wanted you could go ahead and test it in your Power App as per the blog post.
NB: whenever you change your custom connector definition, you will need to remove it from your Power App connectors section and add it back again so the Power App uses the latest version of your connector.
Now the UpdateTask() action:
Caveat: This example shows you how to update the simple types (title, bucketId, dueDateTime, etc). I have not tested using it for the objects like assignments{} or createdBy{}
Click the Definition tab:
Click the UpdateTask action from your Postman import (as above). Fill in the dialog:
Scroll down to Import from sample and click it then add the following (text samples are below the image), then click Import:
https://graph.microsoft.com/v1.0/planner/tasks/{taskid}
If-Match XXXX
Prefer return=representation
{
"bucketId": "",
"orderHint": "",
"assigneePriority": "",
"title": "",
"percentComplete": 0,
"startDateTime": null,
"dueDateTime": "",
"conversationThreadId": null,
"appliedCategories": {},
"assignments": {}
}
Notes on the above:
1. Only the header property names are used. Their values don't matter here.
2. Same for the Body definition / template (hence empty property values). This fragment contains the full list of possible properties one can change according to the Graph docs at the time of writing (December 2019). At some stage the priority property will come out of Beta. When it does we will need to update this connector by adding that to the JSON (or start using the Beta url now, not recommended). If your connector only needs a subset of properties that you wish to make updateable, only specify the ones you need in the JSON.
Scroll down to the Headers section and Edit the If-Match:
set its values like so, then click the Back button to save your changes:
Same for Prefer.
NOTE: the Default value is set because we want to use that on all calls. It is not dynamic and we do not want to have to pass it on every UpdateTask() action (unlike the If-Match header value) so we set the default and set visibility to "Internal". Don't quote me on that explanation but these settings work.
The purpose of the Prefer header with this value is to tell Graph to return the updated Task record. This is not mentioned in the docs but is vital so we get back an updated odata.etag value so we can do subsequent updates on the same record.
Now define the Response Body, then click Import.
Again, the JSON values do not matter, just the property names. To get the JSON, use Graph Explorer to run a Get Task query and copy the response JSON
https://graph.microsoft.com/v1.0/planner/tasks/{task-id}
Finally, update your connector.
Now you can use your custom connector in your Power App. eg in a Gallery template definition for a Task. I have a dropdown control (called "bucket") on each Task record the gallery collection that lists the the buckets on that Plan so the user can use the dropdown to move a task from one bucket to another within that Plan.
This is a simplified version. There is a bit more to this in practical application - the subject of another post.
Items = PlannerCustomConnector.ListPlanBuckets("my plan id here").value
onChange = PlannerCustomConnector.UpdateTask(id,'@odata.etag',{bucketId: bucket.Selected.id})
The take-away here is that the parameter list to UpdateTask() is the taskId AND the If-Match header value (the current etag of ThisItem's Task record) AND the object containing the data to change (the bucketId of the selected item in the bucket dropdown).
Similarly, to update the Task Title:
onChange = PlannerCustomConnector.UpdateTask(id,'@odata.etag',{title: TaskTitle.Text})
where TaskTitle is the control property name of the title field on the gallery item template.
IMPORTANT: at this point the connector should successfully update the server ONCE, but subsequent updates might fail, depending on how you set up your gallery collection. This relates to keeping track of the updated etag that is sent back after each call to UpdateTask(). I do have a work around and lots of questions about that which I will point to once I fully understand the best way forward.
Cheers,
Murray
Hi @Anonymous ,
Could you please share a bit more about your scenario?
Do you want to set a "If-Match" HTTP Request header property within your app when you executing the PlannerCustomConnector.UpdateTask() action?
If you want to set a "If-Match" HTTP Request header property within your app when you executing the PlannerCustomConnector.UpdateTask() action, I have made a test on my side, please consider take a try with the following workaround:
1. Define your "UpdateTask" action within your custom connector as below:
Note: The action patch (/v1.0/planner/tasks/{taskId}) is based on the Base URL you specified in your custom connector. If you specified /v1.0 as your Base URL, the above action path should be changed into /planner/tasks/{taskId}.
2. Edit the "If-Match" header within your operation as below:
3. Edit the If-Match Header as below:
4. Then click "Back" button, and specify proper Body Response Payload for this operation.
5. Save your custom connector.
Then when you executing the PlannerCustomConnector.UpdateTask() action within your app, the "If-Match" header property would be marked as Required property, there you could provide a proper value for it using ThisItem.ETag formula.
Please take a try with above solution, check if the issue is solved.
Best regards,
Thank you! I will work on this later today and report back.
Much appreciated.
Murray
Hi @Anonymous ,
Have you taken a try with the solution I provided above? Have you solved your problem?
If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.
Best regards,
Yes I will set as accepted once I have fully tested. Your post was a great start but there was more to it which I am still working through. One thing is that you MUST also send the following request header item (in addition to the If-Match) otherwise you do not get data back and usually get an error instead. This is not in the docs.
Prefer: return=representation
Once I have a complete working replacement for the UpdateTask() method in my custom connector I will update this post with full instructions. That will be in a few days.
Thanks,
Murray
Sorry for the delay getting back. I now have this working.
So, in addition to the helpful info above there was another request header that was required to make this useful in an app and which is not mentioned in the docs. 😞
Here are the steps to define an action called UpdateTask:
1. This blog post outlines setting up the Azure App permissions etc so your custom connector can authenticate on behalf of the user who is using it (ie you, for now).
Follow that pattern to delegate permissions, generate the secret key, etc. That blog post example requires Directory and Group permissions. For Planner you will also need to delegate permissions for Tasks eg Tasks.ReadWrite (and possibly others depending on what you want your custom connector to be able to do).
2. In the Generate Swagger file section, when using Postman, add API calls for the various Planner calls you want to include in your connector. In terms of this example, we will want one for at least GetTask and UpdateTask
GET https://graph.microsoft.com/v1.0/planner/tasks/:taskid
PATCH https://graph.microsoft.com/v1.0/planner/tasks/:taskid
Note that with some extra work you can use Postman to test your calls, that is not necessary here. All we are doing is defining the API calls we want to build into our custom connector so Postman will build the JSON definition file for us. So, add your calls and continue down to Export your collection of API calls.
3. Follow the instructions in the Create your custom connector section of the blog post.
Build the action for GetTask() first. It is simple and you can use it to make sure all is working before going on to define the UpdateTask() action. Note that in the blog post Todd is using the connector Test tab to get the template JSON to continue with the definition (step 20 or so). In practice, I found it easier to have the Graph Explorer open in another browser window and use it to run the calls in order to get the template / sample response JSON we need for the connector definition.
Once you have built and saved the GetTask() action you can test it to make sure you are on track so far. If you wanted you could go ahead and test it in your Power App as per the blog post.
NB: whenever you change your custom connector definition, you will need to remove it from your Power App connectors section and add it back again so the Power App uses the latest version of your connector.
Now the UpdateTask() action:
Caveat: This example shows you how to update the simple types (title, bucketId, dueDateTime, etc). I have not tested using it for the objects like assignments{} or createdBy{}
Click the Definition tab:
Click the UpdateTask action from your Postman import (as above). Fill in the dialog:
Scroll down to Import from sample and click it then add the following (text samples are below the image), then click Import:
https://graph.microsoft.com/v1.0/planner/tasks/{taskid}
If-Match XXXX
Prefer return=representation
{
"bucketId": "",
"orderHint": "",
"assigneePriority": "",
"title": "",
"percentComplete": 0,
"startDateTime": null,
"dueDateTime": "",
"conversationThreadId": null,
"appliedCategories": {},
"assignments": {}
}
Notes on the above:
1. Only the header property names are used. Their values don't matter here.
2. Same for the Body definition / template (hence empty property values). This fragment contains the full list of possible properties one can change according to the Graph docs at the time of writing (December 2019). At some stage the priority property will come out of Beta. When it does we will need to update this connector by adding that to the JSON (or start using the Beta url now, not recommended). If your connector only needs a subset of properties that you wish to make updateable, only specify the ones you need in the JSON.
Scroll down to the Headers section and Edit the If-Match:
set its values like so, then click the Back button to save your changes:
Same for Prefer.
NOTE: the Default value is set because we want to use that on all calls. It is not dynamic and we do not want to have to pass it on every UpdateTask() action (unlike the If-Match header value) so we set the default and set visibility to "Internal". Don't quote me on that explanation but these settings work.
The purpose of the Prefer header with this value is to tell Graph to return the updated Task record. This is not mentioned in the docs but is vital so we get back an updated odata.etag value so we can do subsequent updates on the same record.
Now define the Response Body, then click Import.
Again, the JSON values do not matter, just the property names. To get the JSON, use Graph Explorer to run a Get Task query and copy the response JSON
https://graph.microsoft.com/v1.0/planner/tasks/{task-id}
Finally, update your connector.
Now you can use your custom connector in your Power App. eg in a Gallery template definition for a Task. I have a dropdown control (called "bucket") on each Task record the gallery collection that lists the the buckets on that Plan so the user can use the dropdown to move a task from one bucket to another within that Plan.
This is a simplified version. There is a bit more to this in practical application - the subject of another post.
Items = PlannerCustomConnector.ListPlanBuckets("my plan id here").value
onChange = PlannerCustomConnector.UpdateTask(id,'@odata.etag',{bucketId: bucket.Selected.id})
The take-away here is that the parameter list to UpdateTask() is the taskId AND the If-Match header value (the current etag of ThisItem's Task record) AND the object containing the data to change (the bucketId of the selected item in the bucket dropdown).
Similarly, to update the Task Title:
onChange = PlannerCustomConnector.UpdateTask(id,'@odata.etag',{title: TaskTitle.Text})
where TaskTitle is the control property name of the title field on the gallery item template.
IMPORTANT: at this point the connector should successfully update the server ONCE, but subsequent updates might fail, depending on how you set up your gallery collection. This relates to keeping track of the updated etag that is sent back after each call to UpdateTask(). I do have a work around and lots of questions about that which I will point to once I fully understand the best way forward.
Cheers,
Murray
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08 23 @WarrenBelz 31 @DBO_DV 10 @Amik 19 AmínAA 6 @mmbr1606 12 @rzuber 4 @happyume 7 @Giraldoj 3@ANB 6 (tie) @SpongYe 6 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08 10@WarrenBelz 25 @DBO_DV 6@mmbr1606 14 @AmínAA 4 @Amik 12 @royg 3 @ANB 10 @AllanDeCastro 2 @SunilPashikanti 5 @Michaelfp 2 @FLMike 5 @eduardo_izzo 2 Meekou 2 @rzuber 2 @Velegandla 2 @PowerPlatform-P 2 @Micaiah 2 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8 SunilPashikanti8
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages