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?
Solved! Go to Solution.
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).
'Date Identified': DateValue(LineDateIdentified),
'Date Closed': If(!IsBlank(DateValue(LineDateClosed)), DateValue(LineDateClosed)),
'Tracking Resolution': LineResolution,
'Contract Name': LineProgramName,
'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.
You need to explicitly force Blank(), ie
'Date Closed': If( !IsBlank(DateValue(LineDateClosed)), DateValue(LineDateClosed), // else Blank() ),
@Eelman 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.
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.
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.
We are excited to announce that Demo Extravaganza for 2021 has started!
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks