web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Why is the code deleti...
Power Automate
Suggested Answer

Why is the code deleting the title and not entering a blank or a date in the date field?

(0) ShareShare
ReportReport
Posted on by
Hi,
 
I am trying to populate a Word document that contains a table with data from data drawn from a Sharepoint List.
 
The Course Subject Titles are already in the Word Table. I am only looking to get the date of course completion entered from the Sharepoint List. However, the code I have written is not working as expected. 
 
Desired outcome
I want the code to enter a date in dd/MM/yyyy format if there is a date in the field on the Sharepoint List or, if there is no date in the field of the Sharepoint List,  leave the date field blank in the corresponding date field in the Word table.
 
What is actually happening?
If there is a date in the field in the Sharepoint List it is entering the text "dd/MM/yyyy" and NOT the date.
If there is no date in the field in the Sharepoint List, it is deleting the name of the course subject.
 
What baffles me is I have only linked the date field in the Word table to the Sharepoint List. There is no link at all in the Course subject field in the Word table
 
What am I doing wrong?
 
Here is the code: -
 
if(empty(item()?['Welfare']),'','dd/MM/yyyy')
 
Word Table
Course Subject Completed (Yes/No) Date Completed
Welfare [No linkage but this title gets deleted]   [Linked field with Title 'Welfare']
     
 
Any help gratefully received.
 
Many thanks,
 
Cliff
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    15,309 Super User 2026 Season 2 on at
    It is putting 'dd/MM/yyyy' into the Word document because that is literally what you are telling it to do with your current expression. You need to replace 'dd/MM/yyyy' with a formatDateTime expression to populate it with a date. You can refer to this reference on how to use formatDateTime: Customize or format date and time values in a flow - Power Automate | Microsoft Learn

    In addition, instead of using if(empty(..., I would use a coalesce expression. You can learn about that at https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-isblank-isempty#coalesce

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 273 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 149 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 144 Super User 2026 Season 2

Last 30 days Overall leaderboard