Skip to main content

Notifications

Power Automate - General Discussion
Answered

Cannot get the 'item()['dueDateTime'] to populate in my email.

(0) ShareShare
ReportReport
Posted on by 58

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:

formatDateTime(item()['dueDateTime'],'MM/dd/yyyy')

 

Respectfully,

Jesse

Categories:
  • ADGToreUp Profile Picture
    ADGToreUp 58 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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! 

  • Sundeep_Malik Profile Picture
    Sundeep_Malik 6,480 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    @ADGToreUp 

    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. 🙂

  • Verified answer
    ADGToreUp Profile Picture
    ADGToreUp 58 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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.  

  • ADGToreUp Profile Picture
    ADGToreUp 58 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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

  • ADGToreUp Profile Picture
    ADGToreUp 58 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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! 

  • Sundeep_Malik Profile Picture
    Sundeep_Malik 6,480 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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.

    Sundeep_Malik_0-1669853410711.png

     

    In parse json passed the output of above compose and in sample just pasted the output.

    Sundeep_Malik_1-1669853448478.png

     

    Then used this expression in a compose to get the due date:

    Sundeep_Malik_3-1669853502200.png

    body('Parse_JSON')?[0]?['dueDateTime']

     

    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']

    Sundeep_Malik_4-1669853587064.png

     

    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 🙂

  • ADGToreUp Profile Picture
    ADGToreUp 58 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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.

  • Sundeep_Malik Profile Picture
    Sundeep_Malik 6,480 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    @ADGToreUp 

     

    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.

     

  • ADGToreUp Profile Picture
    ADGToreUp 58 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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".  

  • Sundeep_Malik Profile Picture
    Sundeep_Malik 6,480 on at
    Re: Cannot get the 'item()['dueDateTime'] to populate in my email.

    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.

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard