cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kmw1130
Post Patron
Post Patron

Patch Blank Date to SharePoint Date Field

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?

1 ACCEPTED SOLUTION

Accepted Solutions
kmw1130
Post Patron
Post Patron

This is what worked when submitting to SharePoint.

 

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

View solution in original post

11 REPLIES 11
Drrickryp
Super User
Super User

@kmw1130 

In the advanced settings, activate Formula level error management.  Then you should be able to patch the date with Blank()

Eelman
Super User
Super User

@kmw1130 

You need to turn Formula-level error management to ON, in Settings then you can simply Patch Blank() to that field.

 

See here

@Eelman It is turned on.  

@kmw1130 

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

kmw1130
Post Patron
Post Patron

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)

Drrickryp
Super User
Super User

@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 

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.

@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.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,175)