I have a table to prepare a quotation having the following columns - [Unit Price], [Discount], [Qty] & [Total]. The column [Total] has an app formula. An action button ‘Approve Quote’ sets the value of [IsApproved] to TRUE and is visible only to managers.
I want that each time the columns in the row is modified or the [Total] changes, the row needs to be approved by the manager through the action button. I have a column TrackChanges that monitors the required columns and set the TrackChanges to Reset.
I have set the initial value of IsApproved to FALSE and enabled Reset on edit. The expression for Reset_on_edit is - [TrackChanges]>0
However, when I edit certain columns and save the row, the [TrackChanges] increments but the [IsApproved] does not reset to initial value. Kindly help me resolve this.
For the condition, you can try with this:
NOT([_THISROW_BEFORE].[TrackChanges] = [_THISROW_AFTER].[TrackChanges])
@LeventK Its not working. The column [IsApproved] does not reset to initial value.
That’s because your [IsApproved] column is a virtual column and the appformula will be re-calculated upon sync. If you are using delayed sync, you need to explicitly hard sync the app.
[IsApproved] is not a virtual column and has no app formula. I have just set the initial value to FALSE and added an expression to Reset_on_edit. Please refer image uploaded with the first post.
I have tried both delayed sync and hard sync the results are the same. The value does not reset.
I tried removing the the above expression and simply enabled the Reset, even then the reset does not happen.
Just to let you know, when I ‘Approve’ the value of [IsApproved] is set through actions.
Sorry @Nirmal_Giri, I have mis-read your post, do apologize. I believe Rest_on_Edit feature might not work when changes are triggered with Actions. Try with this and see if it works:
1.) Turn-off Reset On Edit for the [IsApproved] column.
2.) Create workflow with UPDATES_ONLY for your table.
3.) For the condition use this:
NOT([_THISROW_BEFORE].[TOTAL] = [_THISROW_AFTER].[TOTAL])
4.) Choose Webhook for the workflow type, from Preset parameter choose AppSheet: Edit Row
5.) Choose your table from the Table Name and for the Body use this:
{
"Action": "Edit",
"Properties": {
"Locale": "en-US",
"Location": "48.220599, 16.239976",
"Timezone": "W. Europe Standard Time"
},
"Rows": [
{
"KeyColumnName": "<<[KeyColumnName]>>",
"IsApproved": "FALSE"
}
]
}
If I may request, you could try following approach
Set the existing [TrackChanges] ChangeCounter column to “Accumulate” mode and initial value as 0. Other settings such as Change columns etc. to remain as you already have.
Create a column of Number type, called say [ApprovalCounter] and with initial value as 0
Third column called as [IsApproved] as Y/N type which you already have. Expression for this column [TrackChanges]= [ApprovalCounter]
Action called “Approve” of type “Set the values of some columns in this row” with condition as [TrackChanges]<>[ApprovalCounter] and set the value of column [ApprovalCounter] to [ApprovalCounter]+1
Please test on a new record as initial values are important.
Couple of things:
For your case it doesn’t matter actually
Shall be:
"Row ID": "<<[Row ID]>>"
@LeventK I tired through webhook. The reset is still not happening.
User | Count |
---|---|
36 | |
33 | |
27 | |
23 | |
18 |