pretzelb
pretzelb

Reputation: 1221

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?

Upvotes: 0

Views: 2883

Answers (2)

pretzelb
pretzelb

Reputation: 1221

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();

Upvotes: 0

Murilo Santana
Murilo Santana

Reputation: 665

One way of updating the logic and the value from a Datacard in your form to a datasource is to change the Update property for a specific Datacard

Example - Originally:

enter image description here

Changing the Update values:

enter image description here

or

enter image description here

Where DataCardValue2_6.Text is the text input for the column.

Upvotes: 1

Related Questions