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

Community site session details

Session Id : EEWH1Wzg6kc17EaY5UQXko
Power Apps - Building Power Apps
Answered

Patch Blank Date to SharePoint Date Field

Like (0) ShareShare
ReportReport
Posted on 22 Mar 2021 18:52:36 by 952

I am using a Gallery to Patch and Save to a SharePoint List, one of my fields is a date field (Closed Date).  The ForAll Patch doesn't save to SharePoint unless I have the Closed Date populated.  I want it to be blank until the item is updated.  How can I patch a blank date to SharePoint?

  • KarlH Profile Picture
    31 on 06 Feb 2023 at 07:48:44
    Re: Patch Blank Date to SharePoint Date Field

    My experience with this empty date limitation in PowerAutomate - is that, upon passing a null date value via JSON into a flow, the null crashes the JSON parse action. So the solution to this problem is to make sure all null/undefined values are empty strings, which then clears the JSON parse... however, then, when the Date column processes an empty string, it crashes out the flow. So in order to solve that problem, we have to convert the empty string back to a null value, which then processes as an empty date field as desired.

    Here is the expression that I use in the Date field, upon parsing an empty string "" in my JSON object.

    if(empty(body('Task_Details')?['dateStart']), null, body('Task_Details')?['dateStart'])


    It's these little things that are so frustrating with the flow platform!

  • jdarling20 Profile Picture
    41 on 28 Dec 2021 at 20:26:55
    Re: Patch Blank Date to SharePoint Date Field

    I was able to successfully patch with the following: 

     

    exit_date: DateValue(selectedHistoryItem.previous_value)

     

    This value for the given record results in a Blank() value, but was able to patch successfully AFTER enabling the Formula-level Error Management as noted by  @Drrickryp  and @Anonymous .

     

    This formula will Patch either a Blank() or real date value, whichever the formula returns.

  • Verified answer
    kmw1130 Profile Picture
    952 on 23 Mar 2021 at 13:38:43
    Re: Patch Blank Date to SharePoint Date Field

    This is what worked when submitting to SharePoint.

     

    'Date Closed': If(IsBlank(LineDateClosed), Blank(), DateValue(LineDateClosed)),

  • kmw1130 Profile Picture
    952 on 23 Mar 2021 at 13:25:19
    Re: Patch Blank Date to SharePoint Date Field

    @Anonymous My SP List field is a date field.  I'm creating a collection for a "Repeating Table" Gallery, each row in the Gallery has 2 date fields, one, Date Closed, will be able to update at a later time, so it needs to be blank.  It is Saved to the Collection as a blank entry and then when submitted to my SharePoint List, it doesn't submit the collection values to SP when the date field is blank. 

  • Community Power Platform Member Profile Picture
    on 23 Mar 2021 at 00:16:30
    Re: Patch Blank Date to SharePoint Date Field

    @kmw1130 

    If Patching Blank() works on it's own then this suggests that there is something amiss with your date data type.

     

    Re-reading your code, you appear to be using a Text field and converting that to a Date (ie DateValue(LineDateClosed) ), then whilst using Blank() I think you are mixing up data types ... not sure.

     

    You could try using DateValue( Blank() ) or better still, use a DatePicker to select your dates instead of a text input.

  • kmw1130 Profile Picture
    952 on 22 Mar 2021 at 23:37:18
    Re: Patch Blank Date to SharePoint Date Field

    @Anonymous I tried that and it still does not save the collection items to my SP list.  If I put in a default date when I create the collection, then Save to SP it works.  If I do just Blank() as @Drrickryp suggested, it saves the collection data to SP, but when I got back to edit, the Patch is still set to Blank(), so I would think your If(!IsBlank) solution would work, but it didn't for me.

  • Community Power Platform Member Profile Picture
    on 22 Mar 2021 at 21:53:21
    Re: Patch Blank Date to SharePoint Date Field

    @kmw1130 

    You need to explicitly force Blank(), ie

     

    'Date Closed': If( !IsBlank(DateValue(LineDateClosed)), 
     DateValue(LineDateClosed),
     // else
     Blank()
     ),
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on 22 Mar 2021 at 20:29:13
    Re: Patch Blank Date to SharePoint Date Field

    @kmw1130 

    'Date Closed': Blank(),

    If you are adding a new item as indicated by Defaults('Program Tracking') it will be blank anyway so why the If() function. 

  • kmw1130 Profile Picture
    952 on 22 Mar 2021 at 20:19:05
    Re: Patch Blank Date to SharePoint Date Field

    The Closed date is not required in SP.  Here is my Patch formula (I added the If(!IsBlank) on the DateClosed, but didn't make a difference).

     

    ForAll(TrackingCollection,
    Patch('Program Tracking',
    Defaults('Program Tracking'),
    {
    Title: LineType,
    'AssignedTo-Email': LineAssignedTo,
    Description: LineDescription,
    'Date Identified': DateValue(LineDateIdentified),
    'Date Closed': If(!IsBlank(DateValue(LineDateClosed)), DateValue(LineDateClosed)),
    'Tracking Resolution': LineResolution,
    Likelihood: LineLikelihood,
    Impact: LineImpact,
    'Contract Name': LineProgramName,
    BU: LineBU,
    ProgramID: FormIssues.LastSubmit.ID}));
    Navigate(TrackingOverviewScreen,ScreenTransition.Fade)

  • Community Power Platform Member Profile Picture
    on 22 Mar 2021 at 20:11:10
    Re: Patch Blank Date to SharePoint Date Field

    @kmw1130 

    Can you share your Patch formula. Also, is the Closed date set as 'Required' in SharePoint?

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

Announcing our 2025 Season 2 Super Users!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2