Hi PowerAutomate/Flow experts,
In the planner there are following tasks from projects: Lavender, Marigold & Teal
The Goal is automatically get the tasks from planner into Metrics as below
In Flow:
Since there is no way to group the tasks for relevant projects, it is hard to map them on to Metrics using PowerAutomate:
We can group by Buckets or 1-1 tasks from Planner to Metrics but looking for ways to group tasks via either labels or something else !
UPDATE: When used "gettask" to grab appliedCategories, there is no specific category shown in raw output. Also, how can we group such categories ? should we use a loop & condition ?
Added task with appliedcategories = Dark green (category18)
but still not catching it leading to escaping the condition too.
:(
...Not sure what Create Label here means and there is no current item from the Filter TaskbyLabel in new view
Thanks @Sam for your efforts to help us. It seems even after adding the expresssion, it lead to error.
Also, for the final step, is Output should be UniqueLabels ?
In the step above RenamedLabelNames....there need to be ApplyToEach
Your overall question is pretty broad, however, I will answer your immediate need of "how to group tasks by label". Hopefully that will get you on your way.
Let me say first, I have yet to receive the new UI for Power Automate, so the following is based on the old UI. Just the same, you should be able to apply the same steps/expressions.
Here's the overview of the steps:
And the details behind each step/action:
// Name: DefaultLabelNames
// Action: Data Operation > Compose
// Note: These are the default names of the categories (labels)
// Inputs:
{
"category1": "Pink",
"category2": "Red",
"category3": "Yellow",
"category4": "Green",
"category5": "Blue",
"category6": "Purple",
"category7": "Bronze",
"category8": "Lime",
"category9": "Aqua",
"category10": "Gray",
"category11": "Silver",
"category12": "Brown",
"category13": "Cranberry",
"category14": "Orange",
"category15": "Peach",
"category16": "Marigold",
"category17": "Light green",
"category18": "Dark green",
"category19": "Teal",
"category20": "Light blue",
"category21": "Dark blue",
"category22": "Lavender",
"category23": "Plum",
"category24": "Light gray",
"category25": "Dark gray"
}
// Name: List tasks
// Action: Planner > List tasks
// Note: Gets all the tasks for a Plan
// Inputs: Select your Group Id and Planner Id
// Name: Get plan details
// Action: Planner > Get plan details (Preview)
// Note: Needed to get any custom renaming of labels (categories)
// Plan Id:
first(outputs('List_tasks')?['body/value'])?['planId']
// Name: RenamedLabelNames
// Action: Data Operation > Compose
// Note: Any custom naming of the labels
// Inputs:
outputs('Get_plan_details')?['body/categoryDescriptions']
// Name: PlanLabelNames
// Action: Data Operation > Compose
// Note: Giving the resulting label names of default and custom
// Inputs:
union(outputs('DefaultLabelNames'), outputs('RenamedLabelNames'))
// Name: Tasks
// Action: Data Operation > Select
// Note: Array of tasks that we'll filter later on. Add each field that you need to later create the PBI Metric.
// From:
outputs('List_tasks')?['body/value']
// Map: main one here is "Label" - set it to:
outputs('PlanLabelNames')?[ coalesce(split(string(item()?['appliedCategories']), '"')?[1], 'nolabel') ]
// Name: SelectTaskLabel
// Action: Data Operation > Select
// Note: Single field array of all the labels in all the tasks
// From:
body('Tasks')
// Map:
item()?['Label']
// Name: UniqueLabels
// Action: Data Operation > Compose
// Note: Unique/distinct list of labels
// Inputs:
union(body('SelectTaskLabel'), body('SelectTaskLabel'))
// Name: ForEachLabel
// Action: Control > Apply to each
// Note: Loop through each distinct label
// Inputs:
outputs('UniqueLabels')
// Name: FilterTaskByLabel
// Action: Data Operation > Filter array
// Note: Filter previous Tasks array by label
// From:
body('Tasks')
// Condition:
item()?['Label'] /* is equal to */ items('ForEachLabel')