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?
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.
It's these little things that are so frustrating with the flow platform!
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.
This is what worked when submitting to SharePoint.
'Date Closed': If(IsBlank(LineDateClosed), Blank(), DateValue(LineDateClosed)),
@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.
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.
@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.
You need to explicitly force Blank(), ie
'Date Closed': If( !IsBlank(DateValue(LineDateClosed)),
DateValue(LineDateClosed),
// else
Blank()
),
'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.
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)
Can you share your Patch formula. Also, is the Closed date set as 'Required' in SharePoint?
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2