Search code examples
sharepointpowerapps

Power Apps SharePoint date field not updating on button click


I have a button for the user to submit a SharePoint list item for review. On the click even a variable is set which updates the text status field in the SharePoint list. Here's how the status field is updated, it checks if the value is blank and sets it to draft status, if that fails then it checks the variable status update field for blanks, if nothing in the variable then it uses what is stored, otherwise it takes the value from the variable:

If(IsBlank(Parent.Default),"Draft",If(IsBlank(varStatusUpdate), Parent.Default,Text(varStatusUpdate)))

For the date field, I'm also checking for nothing on the SharePoint list, then I'm checking the same status update variable. When blank, use what is stored in the list. If the value is "pending approval" then it should get current date.

If(IsBlank(Parent.Default),Blank(),If(IsBlank(varStatusUpdate), Parent.Default, If(varStatusUpdate="Pending Approval", Now(),Parent.Default)))

When testing the updated Now() value appears on the screen but it isn't saved to the list. When published to SharePoint the value is never saved or updated.

Any ideas?


Solution

  • Only way I could get this to work was to use the patch command like below:

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