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

Notifications

Announcements

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
    12,982 Super User 2025 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard