In my opinion, the Planner “when a new task is created” trigger is one of the most useful Planner triggers. Tasks are created frequently, and having a way to catch and, for example, add checklist items or assign them automatically to a default person saves a lot of time.

So let’s take a look at the “when a new task is created” trigger and how we can use it efficiently in Power Automate.

Where to find it?

You can find it in the Planner’s section.

And then select it from the list.

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

Usage

Triggers usually require little configuration. Usually, you need to define where to “point” and look for changes.

In the case of the Planner “when a new task is created” trigger, we need to define:

  1. Group Id – This list shows all A.D. Groups. You can find the full list in your Azure Portal (you need to be an administrator to see the groups). These groups can be created automatically for you or define, but this is a topic for another article. What’s important to know is that not all groups have planner instances, so you may see the next item empty.
  2. Plan Id – The unique identifier for a planner within the selected group. Please note that the plan must exist, so you can’t create one within the trigger.
One important note. Microsoft Planner enables you to create a planner without defining the group. If this is the case, a new group will be created with the name of your planner. If you want to add it to an existing group, please select it from the list when creating the planner.

Outputs

The trigger returns a lot of information in a JSON format, although the conversion from JSON is done automatically for you. Here’s an example:

{
    "headers": {
        "Transfer-Encoding": "chunked",
        "Vary": "Accept-Encoding",
        "Strict-Transport-Security": "max-age=31536000",
        "request-id": "8b2e38e7-13c8-4ad1-836b-bfd79f2980ae",
        "client-request-id": "8b2e38e7-13c8-4ad1-836b-bfd79f2980ae",
        "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"003\",\"RoleInstance\":\"AM1PEPF000051D6\"}}",
        "OData-Version": "4.0",
        "retry-after": "60",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "Cache-Control": "no-cache",
        "Date": "Wed, 23 Jun 2021 10:51:38 GMT",
        "Location": "https://europe-002.azure-apim.net/apim/planner/shared-planner-1dafa0a6-7d3f-4c33-bb9a-d5ab-cbbffb7e/v2/v1.0/planner/onnewtask_trigger/plans/fa-pSzbK60u2VCQcvxNGpZcAHT7g/tasks?groupId=7298f324-11111-1111-11111-8c0660469d96&triggerState=6376004224511111111",
        "Content-Type": "application/json",
        "Content-Length": "1124"
    },
    "body": {
        "@odata.etag": "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBARCc=\"",
        "planId": "fa-pSzbK1112VCQ1111NGpZcAHT7g",
        "bucketId": "fPjsGArNo011111_PYHU11111LWX-",
        "title": "Item 1",
        "orderHint": "8585771615111118015Pi",
        "assigneePriority": "",
        "percentComplete": 0,
        "createdDateTime": "2021-06-23T10:50:45.1150323Z",
        "hasDescription": false,
        "previewType": "automatic",
        "referenceCount": 0,
        "checklistItemCount": 0,
        "activeChecklistItemCount": 0,
        "id": "GP11QCNV111TPWT111fJC511111MSn",
        "createdBy": {
            "user": {
                "id": "b6a19137-1111-1111-1111-1a43ba4739fb"
            }
        },
        "appliedCategories": {},
        "assignments": {},
        "_assignments": []
    }
}

I’m showing you this because it’s important to read this information when you’re debugging your Flow. To know what the trigger returned:

Then click the “outputs.”

You’ll get a “raw” version of the JSON displayed above.

It’s important to look at the “body” section:

I know this looks horrible, but you can use sites like JSON Beautify (not a sponsor or affiliate link) to get the data correctly formatted.

With this information, you can check if the data that you’re expecting is the data that the Flow gets. The fields are readable, so you know if you have “assignments”: {} then there’s one assigned to the task, for example.

If something’s wrong, but you get the correct data, then you know that there’s an issue somewhere in your Flow.

Limitations

There are some Microsoft Planner Task fields that won’t be returned in the trigger. To get them, you need to use the “Get task details” action.

The items are:

  1. Description, but you’ll get a flag indicating if there’s a description or not
  2. Last change date (“Get task details” action won’t return this)
  3. The name of the person that created it. You have to use the “Get user profile (V2)” action.
  4. The labels (“Get task details” action won’t return this)
  5. The start and due date (“Get task details” action won’t return this)
  6. The attachments (“Get task details” action won’t return this)
  7. The comments (“Get task details” action won’t return this)

You’re not able to do any filter on the data or when it will trigger. The Flow will run for all

Recommendations

Here are some things to keep in mind.

Name it correctly

Although the name is descriptive, always try to adjust it to the correct type of task that you’re getting. For example, “When a new task is created in the To-Do List Planner.” Always build the name so that other people can understand what you are using without opening the trigger and checking the details.

Always add a comment.

Adding a comment will also help to avoid mistakes. You don’t need to indicate the group or the planner because the person can see it, but it’s important to define what data is returned, if there are restrictions or filters, and if the data is sorted or not. Include any other data that is important to know. It’s important to enable faster debugging when something goes wrong.

Always deal with errors.

I know that this is strange since the trigger usually won’t return an error. But it’s important to validate if the data that is received is in the format you expect. For example, if you have a field that is essential for your Flow to run but is not in the trigger, it doesn’t make sense to continue. Return an error and issue warnings so that these errors won’t fall in the cracks.

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 Trigger Reference.

Manuel Gomes

I'm a Project Manager with experience in large projects and companies. I've worked in the past for companies like Bayer, Sybase (now SAP) and I'm currently working for Pestana Hotel Group.

View all posts by Manuel Gomes →

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: