metricspower-automatemicrosoft-planner

Why PowerAutomate is unable to map the bucket name grabbed from planner to Status of metrics?


The goal is to extract the bucket name of the task from the planner and map it to Scorecard metrics' Status.

  1. Task == Metric
  2. Bucket name == Status

While the logic and aftermath evidence in the PowerAutomate Flow shows the bucket name is grabbed correctly for the corresponding task, the scorecard is not reflecting the correct status instead it displays randomly Completed or Done or Not Started for all the tasks ! but the real bucket names are as below

Tried the following:

  1. Renamed the Metrics'Status in advance in scorecard directly(manually) so that mapping could be straight forward for PowerAutomate/Flow but its of no use
  2. Used Compose to gather the bucket name is structural way and then give it to Create a Goal Status. Additionally, tried trimming the bucket name within the Compose too ! but even then there is no change is the metrics status

Set up of the Flow:

  1. Flow-part above with expressions highlighted

  2. Flow-part below with expressions highlighted

Missing expression are as follows:

  1. Name field of the Create a Goal is filled with items('ForEachTasks')?['title'] which is coming from Tasks mapping above

  2. Input to LoopToFindBucket is outputs('List_buckets')?['body/value']

  3. Condition comparison expression is items('ForEachTasks')?['Status'] is equal to items('LoopToFindBucketName')?['id']

  4. Update a Goal Status expression is outputs('Compose')

Flow run successfully and can see the bucket name is collected correctly in the Update a Goal status

But in Scorecard, the gathered Status is not displayed

References: https://powerusers.microsoft.com/t5/Building-Flows/Getting-bucket-Name/td-p/171129

Update

But in Scorecard, Although Status has showing bucket names but its not mapping correctly, e.g. this tasks supposed to have Blocked/On hold.

Scorecard metric with the task in observation


Solution

  • It seems you can only set the status to the predefined enum of statuses.

    Flow save failed with code 'OpenApiOperationParameterValidationFailed' and message 'Input parameter 'Goal' validation failed in workflow operation 'Update_a_goal': The API operation 'UpdateGoal' requires the property 'Goal/status' to be set to one of its defined enum values '["Leave unchanged","Not started","On track","At risk","Behind","Overdue","Completed"]' but is set to 'Peanuts'.'.

    A possible solution is to create a new Compose with the following:

    {
      "In Progress - Implementation": "On track",
      "Bucket name 1": "Not started",
      "Bucket name 2": "At risk"
      // and so on
    }
    

    Then in your Update a goal action, for the Status, use this expression:

    outputs('MapStatus')?[trim(items('LoopToFindBucketName')?['name'])]
    

    Where MapStatus is the name of the Compose action with the above Json object mapping dictionary.