Action Failed Column is required (when using in Form Saved Event)

I have a column called [Label].
Required_If is set to CONTEXT("View")="Label_Form".
So, if I’m working in the Form View, it is required.

I’ve created also an Action, that deletes the [Label] column.

This Action is fired after saving the form.

But when I save the form, I get this Error Message:

2X_1_1a270b658768968b99ef3a2199abb6273f4c0975.png

I thought it would work, because an Action is not working in a Form View.
As mentioned, the Required_If is set to CONTEXT("View")="Label_Form".

This is happening only, when the Action is set to the Form Saved Event.
When I fire the Action via the Detail View, it works perfectly.
2X_1_122bcf5e211514ba72375e4d2966152ff6ea7091.png

Solved Solved
2 15 1,080
1 ACCEPTED SOLUTION

Here is the answer from AppSheet Support Team:

Hi Fabian. For the actions that triggered by a form view, it is arguable in either way whether or not the those actions are considered in the CONTEXT of the form view. Our current implementation follows the ‘yes’ argument. The reason is that the “Form Saved” action is executed before the UI state transitions away from the form. The action has to run before view navigation, as the action may replace the default navigation. Hence the view context will still be the form.

I know this is not ideal and may be confusing to users. As the team is now working on adding capabilities for workflow automation, this might be revised per our development of new application models for workflow. Thanks for your continued support and feedback!

View solution in original post

15 REPLIES 15

Hi @Fabian,

I believe the sequence of operations described by you could be evaluated in the context of the below two statements in the article on Required_if constraint

There are two sentences in the article that we may refer

  1. In the first paragraph of the article it is written- "If a required column value is blank, the row cannot be saved."

  2. Under the section " Scope of Required_If" it is written

The Required_If column constraint is applied any time a row update is attempted, such as when the user interacts with a form view or with a Quick Edit column (e.g., in a detail or table view), when app formulas and initial values are applied, and when [actions](https://help.appsheet.com/en/articles/953637-actions-the-essentials) attempt a data-change operation.

Thank you very much for this useful input, @Suvrutt_Gurjar

But the point is: It should work, beause I set the Required_If to: CONTEXT("View")="Label_Form" .

Interestingly, it is working when we use an Action Data: add a new row to another table using values from this row.
As you see in this screenshot, I don’t have to assign a value to the [Label] column.

Hi @Fabian,

Thank you. Somehow I am unable to understand the "Add One Row"action.

As per my understanding the combined functionality of A)" update the a column through action" amounts to updating a row and B) setting it to “blank” is not allowed by the Required_if constraint definition could be playing a role irrespective of CONTEXT(“View”) setting.

Of course, my understanding may be incorrect. Your analysis definitely makes sense. I am sure we will get more insights from the community.

Hi @Fabian,

If I may add, two pleasant updates to this thread

  1. Your assumption is totally correct that action should work together with CONTEXT(“View”) based Required_if constraint.

  2. I tested “delete” action ( basically setting the column value to “”) .It is just that I applied a constraint on the action also that the action is available only in detail view with an expression CONTEXT(“View”)=“ViewName_Detail” in Actions–> Behavior setting under --> “Only if this condition is true” . The Required_if constraint of CONTEXT(“View”)=“ViewName_Form” was also in place.
    I tested it successfully on a text type column and an image type column.

So with this, essentally both constraints- A) action working in detail view and B) Required_if working in form view coexist together on the same column.

Hope this helps.

Thank you so much @Suvrutt_Gurjar
With your help I found out the reason:
This Bug is happening only, if I set the Action to the Form Saved Event.
I’ve updated my first post and will contact AppSheet Support.

Hi @Fabian,

You are welcome and glad to be of any minor help. We keep getting so much insights from you all ( Your Tips and Tricks with @tsuji_koichi , @Jonathon, @LeventK and other experts are so useful) and I am pleased to be of any small assistance.

Got it that you wish it to happen with “Form Save” event. Yes, I also believe it is a bug and yes, AppSheet support will help further.

Hi @Fabian

May I request you , if possible to update a bit more about this current use case?

If the column is set to required_if in form view, any specific use case where it will need to be blank or deleted on form save through action?

Also I believe, a required_if by nature is set on form view unless we have Quick Edits in detail or table view. So any specific reason, the use case to set it explicitely through CONTEXT() expression on form view.

Will appreciate your insights, if possible. I am definitely missing some point.

@Suvrutt_Gurjar I’m using an OCRTEXT() column.
If the image is too bad, OCR will not work.
So the User has to select “Repeat Image” in an Enum column.
By selecting “Repeat Image” the Form will get saved, because I’ve enabled “Auto save”.
By saving the form, a grouped Action is fired:

  1. Delete the image
  2. Open the form again to take the picture again (same record)

The Cam will open automatically, because [Image] is required, and I’ve enabled “Advance forms automatically”.

All at all this would be a smooth experience for the user.

Thank you @Fabian. Got it. Your use case is to make operation very user friendly and your solution as usual is very ingeneous. I got good insights being partof this post thread.

Thank you again.

Steve
Platinum 4
Platinum 4

Try changing this:

CONTEXT("View")="Label_Form"

to this:

"Label_Form"=CONTEXT("View")

@Steve I tried this, but with no luck. I get the same Error Message.
2X_f_fa3bdaeb9972498a3a16cecedc24f963422df296.png

By the way: Why should it make a difference?

In some cases, CONTEXT("View") can return blank. If blank, the expression would be TRUE regardless even if the action is performed outside of a view (e.g., in a workflow).

So we should prefer in general
"Label_Form"=CONTEXT("View")
instead of
CONTEXT("View")="Label_Form"
?

I do, yes.

Here is the answer from AppSheet Support Team:

Hi Fabian. For the actions that triggered by a form view, it is arguable in either way whether or not the those actions are considered in the CONTEXT of the form view. Our current implementation follows the ‘yes’ argument. The reason is that the “Form Saved” action is executed before the UI state transitions away from the form. The action has to run before view navigation, as the action may replace the default navigation. Hence the view context will still be the form.

I know this is not ideal and may be confusing to users. As the team is now working on adding capabilities for workflow automation, this might be revised per our development of new application models for workflow. Thanks for your continued support and feedback!

Top Labels in this Space