Hello everybody,
I got help with pulling tasks that are coming due, and was able to use this knowledge learned to build a flow where it emails assignees of tasks daily that are past due. Everything works great, until i try to add the due date of the item in the body of the email. I posted a pic of my flow.
Issue item:
Respectfully,
Jesse
Not a problem at all! I still learned from what you posted, and it was very valuable. I just happen to stumble across something in other research that gave me the answer I needed... thank you for your time and patience in trying to help me!
Sorry, my bad, I was really not active this week on the community, so totally forgot to answer your question.
Great to hear you solved it on your own. 🙂
I ended up solving this myself and am posting this in case someone else runs into the same issue. for the Date, I was using expression 'item()['dueDateTime']', but I needed to use items with the "S". I used 'items()['dueDateTime']' and it worked out great.
Do you have a snippet of the whole flow? I guess I may be mistaken from what you mean. I setup my new flow to send the filter array into a parse JSON and the input is the same as the output I get, in the same format. I then re-read what you said, and you told me to copy the output of the filter and paste it into the parse JSON sample, but if i have to do that daily then this is not truly automated. I will continue to try with this parse JSON, it is something i want to learn, but could you please clarify the process more? I attached a snip of how i ran my flow, it is most likely not what you were trying to guide me to do, lol. I am new to this stuff. thank you.
Respectfully,
Jesse
I also apologize for the late response. I was not at work yesterday. I will try this and get back to you. Thank you for the help, I appreciate it greatly!
Hey @ADGToreUp
Sorry for late reply, just came back home from office.
So, there many methods by which you can do this.
1st Method:
Parse Json: Easiest. One of the most important actions in power automate.
Just pass the output of filter array in parse json. From the run history, paste the output of filter array in the sample of parse json. By this you will be able extract all the values you want from your data.
So, for this I saved your data in a compose.
In parse json passed the output of above compose and in sample just pasted the output.
Then used this expression in a compose to get the due date:
2nd Method. Really easy:
Added your data in a compose. Then just used the following expression to get the due date without any apply to each.
outputs('Compose')?[0]?['dueDateTime']
Rest there are many other methods to solve this, if the above two does not work, I will tell them too. But I am sure the above two will work.
For the title too, you can write the same expression to skip the apply to each.
outputs('Compose')?[0]?['title']
Rest if you are confused about parse json, giving you a link to a video, to understand it better:
https://www.youtube.com/watch?v=e0dzMqoJGtY
I hope the above methods work. Going to sleep now, 6 am here. zzzzz 🙂
I highly appreciate the compliment, but i cannot take credit for that. I did change it a little, but the majority of it came from another power user in the community who was super helpful. I learned a lot from it, though! Please see below, and thank you for your help.
I created one task item that is past due as a tester, so it only brings the one item through that filter, which is good.
No, actually I needed the sample data you are getting in that filter array.
Let's say you are getting Name, date, email etc in that array.
[
{ Name: Abc,
Email: abc@gmail.com,
DueDate: 11/29/2022
}
]
So, just remove your personal information from the filter array output and paste here, so that I can help you further.
Btw nice logic in the filter array. You did quiet a good job.
I tried this one before and got the same thing again this time. it gives me this error:
InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '0' and column '0': 'The template language function 'item' must not have any parameters.'.
I also tried it using "formatDateTime(item('Apply_to_each_2')?[dueDateTime],'MM/dd/yyyy')" Just to see if it would work in case it was in the body... same thing.
My filter array is:
@And(and(not(equals(item()?['percentComplete'], 100)),equals(empty(item()?['dueDateTime']), false)),less(formatdateTime(item()?['dueDateTime'], 'yyyy-MM-dd'), utcNow('yyyy-MM-dd')))
This works well and does give me the tasks I need to see. It also allows the assigned users emails to be brought into the To: field. To get those I used "item()['userId']" at the "get user profile".
Hey @ADGToreUp
Not 100% sure this will work or not.
As your due date is inside that apply to each, you are not able to access it with the above expression.
Write something similar to this:
formatDateTime(item('Apply_to_each')?[dueDateTime],'MM/dd/yyyy')
If the above does not work, can you send a sample of your array. I would be able to suggest you a better solution.