Hello,
I've put together a flow that creates a new task whenever I complete an old task. Everything works correctly except for getting the label/category from the old task to correctly be added to the new task. I found another thread that had some suggestions but those didn't seem to work for me. I feel like I'm close to getting this to work but I need a little help to figure out why it isn't working.
A high-level example of what I'm doing:
Test Inspection (old task): Due Date - 05 MAR 2023 ---> Test Inspection (newly created task through flow): Due Date - 04 APR 2023.
I'm able to get everything to copy over correctly, like I said above, except the category. Here is what I have in my flow:
The formula I'm using is: not(empty(string(triggerOutputs()?['body/appliedCategories/category1'])))
I've applied this to all the categories I'm using and have updated the formula to show category1, category2, etc. as applicable.
However, my flow is not adding a category to the new task it creates. When I check to see the outputs, I see that FALSE is what has been listed. Could someone let me know what I did incorrectly here?
Thank you,
I know this is a little old, but I was trying to do something similar with copying tasks from one plan to another.
I found that the label values returned when using "List Tasks" was a cleverly formatted array, not independent values for each category. Meaning its not returning 'appliedCategories/category1' = true. It's returning 'appliedCategories' = '"category1":true'
Since it doesn't list labels that aren't assigned in the result, you only need to look for 'category#' in the response. The expression to use in each color of the create task function would be:
if(contains(items('For_each')?['appliedCategories'], 'category1'), true, false)
That is for Pink, then 'category2' for Red and so on. (mine is in a For_each because I am copying many tasks in my flow)
Hope that helps others who are trying to figure out how to copy the labels from one task to another.
coalesce(triggerOutputs()?['body/appliedCategories/category1'], false)
Ultimately what I'm trying to do is copy a plan from one team to another newly created team. I have everything working, even descriptions and references. But I CAN NOT get the labels to work! Please help
This flow runs fine but for some reason the pink category is not populated.
This is the json from the list tasks for a true statement for category 1
And is there a way to use the value Pink from the get tasks? If I just put value Pink in the flow it errors out because value Pink is equal to "null".
Thank you both for the help. I looked through my expressions and didn't see any obvious typos. Using the coalesce(triggerOutputs()?['body/appliedCategories/category1'], false) expression resolved my issue.
Can you try the following expression and see if it works as expected.
coalesce(triggerOutputs()?['body/appliedCategories/category1'], false)
----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
Hi @Neverous,
Your expression looks alright.
Might be worth double checking your expressions for typos. I would suggest to check your category expression mappings in the peek code/code view of the create task v3 action.
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional