November 29, 2024

Most of the time, the “Get a task” action is used with the “When a new task is created Trigger” because the trigger won’t return any details; we need an action that will fetch the information.

Where to find it?

To find it, you can search for the “Get a task” action.

Here’s what it looks like:

Pro Tip: Power Automate tends to save the most common actions in the main screen, so check there before going trough the full hierarchy. Also you can use the search to quickly find it.

Usage

Like mentioned before, the planner’s “Get task” action goes along with the “When a new task is created” trigger. We’ll use a task from the dropdown to test this action, but it will be quite common for you to use the ID instead.

We’ll get the following information:

  1. ID
  2. Title
  3. Created By User Id
  4. Percent Complete (0 to 100)
  5. Start Date Time
  6. Created Date Time
  7. Completed Date Time
  8. Due Date Time
  9. Has Description
  10. Assignments
  11. Plan Id
  12. Bucket Id
  13. Reference Count
  14. Tags

There’s one that is missing from this list, and it’s the “Priority.”

I’m sure there’s a good reason for this, but you can’t get it with the “Get a task” action for now. Let’s explore the ones we get.

Dates

All dates are returned in the ISO format, including milliseconds. For example:

2021-04-25T18:19:46.9749115Z

The format can be confusing to many, but Flow does an amazing job of converting the date to something you can understand based on your preferences.

Tags

The tags are still a week spot for all actions related to Planner. All of them are individual returns by the color name, even if you rename them.

There are other examples, such as the references or checklist items in the “Get task details” action, where we get an array with the selected ones. In this case, we need to know the tag we’re looking for and check if the tag was assigned (the value is true or false). Of course, if we want the list of tags, this will be unnecessarily cumbersome, but I’m sure this will change in the next version of the action.

Percentage

The percentages are returned with a 0 to 100 instead of the common 0 to 1 scale. This makes things easier to understand since we display the value without converting it.

Has description and Reference Count

I love the inclusion of these two fields. Without us needing to run the “Get task details” action, they will indicate if we have information in these fields. It’s super useful, but it’s a pity that we don’t have one for the checklist items also.

Assignments

Tasks can be assigned to multiple people. This field can be quite complex to understand since it will return a complex object. For example:

[
  {
    "userId": "<redacted>",
    "value": {
      "@odata.type": "#microsoft.graph.plannerAssignment",
      "assignedDateTime": "2021-04-25T18:19:46.9749115Z",
      "orderHint": "8585717240476885258PU",
      "assignedBy": {
        "user": {
          "id": "<redacted>"
        }
      }
    }
  }
]

If you want to get more information, you can always use the “Get user profile” action using the ID as a reference.

Limitations

As mentioned above, the tasks have more information than the one returned here, like:

  1. Description
  2. References
  3. Checklist items

To get this information, you need to use the “Get task details” action. Strangely, Microsoft decided to break the task’s information into two actions, but I’m sure that there’s a good reason for this. I like that we get less information by the task to run faster, but having all in one action would also be convenient.

Recommendations

Here are some things to keep in mind.

Never generate the ID yourself.

Always get the ID either from a trigger or from another action. Never try to generate the ID yourself since they may change, and then your Flow will fail.

Name it correctly

The name is super important in this case since having only “get a task” doesn’t tell us much. Always build the name so that other people can understand what you are using without opening the action and checking the details.

Always add a comment.

Adding a comment will also help to avoid mistakes. Indicate where the task that you’re trying to get (or the context). It’s important to enable faster debugging when something goes wrong.

Always deal with errors.

Have your Flow fail graciously when the task doesn’t exist and notify someone that something failed. It’s horrible to have failing Flows in Power Automate since they may go unlooked for a while or generate even worse errors. I have a template, and a template that you can use that will help you make your Flow resistant to issues. You can check all details here.

Am I missing something? Leave a comment or interact on Twitter. Let’s work together to make this reference as complete as we can

Back to the Power Automate Action Reference.

Photo by Torbjørn Helgesen on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

3 thoughts on “Power Automate: Planner – Get a task Action

  1. If there is a good reason for not being able to get the priority of a task, I’d sure like to know what it is, and then ask MS they know what the definition of the work priority is? It is ridiculous to me that an indicator of how important a task is, would be omitted from the details. I give this 5 head shakes…

    1. I understand the frustration, and I share my skepticism on why this was not included. I will ask around, and if I find the reason, I’ll add it here for future reference :).

  2. Hello,

    I would like to know how to create the work flow in power automate planner task for the outlook 365 (if its shared mailbox) – when the email is flaged or if its complete ?
    Did you have example ?
    Thanks a lot

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon