My canvas app submits a new SP form [Form1] to a SP list, runs a Flow to create a site based on info in the form, and then displays a success/error message based on the response from PowerAutomate. When they get the failure screen, a button is presented that they can click on to navigate to a new screen where they can edit the field which caused the fail message.
I cannot figure out how to update the current item on the new screen which displays a new form control [Form3] with just the field they need to edit [ProjectName]. Below is a screenshot of the screen, and I have included relevant properties and their corresponding code I have entered.
Project Name_DataCard3 Properties:
If( !IsBlank(Form1.LastSubmit.ID), Form1.LastSubmit.ProjectName, ThisItem.ProjectName )
Also note, when testing [hitting play button], Form3 states it is 'getting your data,' but never loads. Certain this is due to the fact that there isn't any filter on the Form properties to get the values of Form1.LastSubmit.
Solved! Go to Solution.
Use the Patch function
Modify or create a set of records in a data source
Patch( DataSource, BaseRecordsTable, ChangeRecordTable1 [, ChangeRecordTable2, … ] )
- DataSource – Required. The data source that contains the records that you want to modify or will contain the records that you want to create.
- BaseRecordTable – Required. A table of records to modify or create. If the record came from a data source, the record is found and modified. If the result of Defaults is used, a record is created.
- ChangeRecordTable(s) – Required. One or more tables of records that contain properties to modify for each record of the BaseRecordTable. Change records are processed in order from the beginning of the argument list to the end, with later property values overriding earlier ones.
You can also use the UpdateIf function
but if so, you should double check the conditions and change record.
Use the Update function to replace an entire record in a data source. In contrast, the UpdateIf and the Patch functions modify one or more values in a record, leaving the other values alone.
UpdateIf( DataSource, Condition1, ChangeRecord1 [, Condition2, ChangeRecord2, ... ] )
- DataSource – Required. The data source that contains the record or records that you want to modify.
- Condition(s) – Required. A formula that evaluates to true for the record or records that you want to modify. You can use column names of DataSource in the formula.
- ChangeRecord(s) - Required. For each corresponding condition, a change record of new property values to apply to records of DataSource that satisfy the condition. If you provide the record inline using curly braces, property values of the existing record can be used in the property formulas.
In your case, you should double check that Form1.LastSubmit has a value or else Form1.LastSubmit.ID will not have any value as well. The form Form1 must be submitted for this to have a value.
Also, does Form1.LastSubmit.ID need to have Value surrounding it? When we re-checked it now, Form1.LastSubmit.ID already should return a number when used in SharePoint List, and the data type should match the underlying data source of this particular formula - is there specific reason it must have Value surrounding it?
Thanks, I had Patch first but this created an entirely new record in the SP list. And you are correct, I only want to change that one field which is why I used UpdateIf or Patch, but thanks for the additional reference info!
Yes, in order to get to that screen, I would have already submitted the Form1 form -- as the reason I need this screen is because the Flow was not able to create the site because the site with that Project Name already exists.
Yes, Value needs to be there otherwise I get an error that PowerApps can't read the function because it's expecting an integer. I appreciate this text, but I'm not sure this helps my specific issue as I'm not sure what to do with this information since I already know this?? Thanks for your input all the same!
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
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