Skip to main content

Notifications

Community site session details

Community site session details

Session Id : aO904kX/Mwh2ZlqhD1OnlO
Power Automate - Building Flows
Answered

Creating HTML table of Azure DevOps query list/date conversion for every work item

Like (0) ShareShare
ReportReport
Posted on 29 Apr 2019 19:10:20 by

Hello,

 

I am currently building a Flow to return a list of items from a query in Azure DevOps (VSO/VSTS), which will create an HTML table from the data, then send it in an email.

 

The one part that I am stuck on is how to convert the date/times to something that's human-friendly. For example, from ADO, this is the format:

 

Capture.PNG

 

I can easily do the conversion to the format I want (12/20/2018 format) for one value, but I'm unsure how to do it for an entire list.

 

Here is what I have so far: 

Capture2.PNG

 

 

Here is the formateDateTime function I have in the HTML table, which works for converting the Current Time action into the correct format:

formatDateTime(body('Current_time'),'MM-dd-yyyy')
 
How would I run every list item through that conversion?
 

Thank you for your help!

  • iivanov Profile Picture
    on 30 Apr 2019 at 17:24:26
    Re: Creating HTML table of Azure DevOps query list/date conversion for every work item

    Short update from me since I was able to use some support threads here to get this one figured out. Here's what I used to get around NULL values:

     

    if(empty(body('Get_work_item_details')?['fields']?['YOUR_FIELD']), '', formatDateTime(body('Get_work_item_details')?['fields']?['YOUR_FIELD'],'dd-MM-yyyy'))

     

    This IF statement will evaluate if your field is empty; if it is, it will output a blank string (''). If it's not empty, it will format date/time of your chosen field to the dd-MM-yyyy format.

     

    Thanks again @v-bacao-msft !

  • iivanov Profile Picture
    on 30 Apr 2019 at 16:34:40
    Re: Creating HTML table of Azure DevOps query list/date conversion for every work item

    Thank you for the quick reply @v-bacao-msft ! Works perfectly!

     

    I have some values, such as dates and a few other string parameters, that may be empty in ADO. How would I account for that so that the email doesn't fail when these are null?

     

    Thank you again!

  • Verified answer
    v-bacao-msft Profile Picture
    on 30 Apr 2019 at 02:29:21
    Re: Creating HTML table of Azure DevOps query list/date conversion for every work item

    Hi @iivanov ,

     

    I don't know the specific configuration of Parse JSON and Assemble list into table action. Could you provide more details about them?

     

    I guess you want to integrate the details of the items obtained in Get Ready for Triage query action into an HTML table.

    If so, I recommend using Get work item details and array variables to organize the table content.

     

    Please consider using the following method to configure Flow.

    • Initializes an array variable and iterates over the value of Get Query results action.
    • Configure Get work item details action and append the contents of its output to the HTML table.
    • For the format of Date, please refer to the following Expression:
    formatDateTime(body('Get_work_item_details')?['fields']?['Microsoft_VSTS_Common_StateChangeDate'],'MM/dd/yyyy')

    Image reference:

    17.PNG18.PNG

    Tips:

    When configuring Append to array variable action, the Dynamic content related to Get work item details may not be available.

    Please try to specify a Type in Work Item Type field first. After Append to array variable action is configured, you could select Enter custom value and use Dynamic content-Work Item Type generated by Get query results to configure this field.

     

    Best Regards,

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,658 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started