pretzelb
pretzelb

Reputation: 1221

Power Apps SharePoint form setting date/time field to blank

I have a form that sits on top of a O365 SharePoint site list with a simple submit button to set the status and the submit date like this:

Patch('LTRequest', ThisItem,{
   SubmitDate: Now(),Status:Text("Pending Approval")});
Back();

What I want to do is create a reset button to change the status and set the date to blank or nothing. But no matter what I try the date is not affected and no error is thrown. Here's what the reset button looks like:

Patch('LTRequest', ThisItem,{
   SubmitDate: DateValue(Blank()),Status: "Draft", ApprovalDate: Blank()});
Back();

Any ideas how to do this?

Upvotes: 1

Views: 5054

Answers (3)

HSS
HSS

Reputation: 176

From my own experience earlier this year, and my investigation, you can't clear a datetime field in SharePoint from PowerApps..

I know - crazy! It may be fixed now but it doesn't like it is..

There's a workaround here

"I ended up adding a second column in sharepoint Date/time and text I set text to be the date column that shows in sharepoint. Date/time column is hidden. I set text field to = date or blank"

Upvotes: 1

SeaDude
SeaDude

Reputation: 4385

I'd remove the Back() statement during debugging. You might actually be receiving an error but because you're navigating away from the screen right away, you may be missing it.

That being said, remove the DateValue from around Blank() and try that.

Patch(
    'LTRequest', 
    ThisItem,
        {
            SubmitDate: Blank(),
            Status: "Draft", 
            ApprovalDate: Blank()
        }
)

If that doesn't work, I'd try an Update() function:

Update(
    'LTRequest', 
    ThisItem,
        {
            SubmitDate: Blank(),
            Status: "Draft", 
            ApprovalDate: Blank()
        }
)

Upvotes: 0

Murilo Santana
Murilo Santana

Reputation: 665

You can enable an experimental feature to get around that: Formula-level error management

However, you might introduce more errors/promblems to the app by turning that feature on.

Formula-level error management

Upvotes: 0

Related Questions