# What happens during an 'On Submit' function

**URL:** https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299
**Category:** Ask for Help
**Created:** [January 30, 2024, 5:47pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299 "2024-01-30T17:47:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [January 30, 2024, 5:47pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/1 "2024-01-30T17:47:33Z")

</div>

I have an “On Submit” action that does lots of housekeeping based on the ‘submit’.

In a handful of cases I ‘update’ the table used for the submit (clearing a temporary variable).

Everything works as expected EXCEPT when I set-col-val the ‘submit table/row’ to clear a variable. The submit fails. I removed the set-col-val and everything works.

How does On Submit work? What are the rules of thumb? For example - NEVER update the ‘submit’ row even if you are updating hidden values.

---

<div class="post-metadata">

### Author: ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)
#### Post date: [January 30, 2024, 6:04pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/2 "2024-01-30T18:04:12Z")

</div>

As a rule of thumb, it’s good if the data being treated in the on-submit is different than data being treated in associated the custom action.

For example, if the custom action includes an add row and the on-submit include an set column value of that row (possibly what you are doing), then it is possible that set-col-val is triggering even before the new row has been added.

What you can try: in your on-submit, before you set-col-val, include a wait action of 1-3 seconds. That might help. But it does go against the rule of thumb.

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [January 30, 2024, 6:34pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/3 "2024-01-30T18:34:06Z")

</div>

I might be the minority, but I almost never experience issues with Form Submit → On Submit Action → Set Column Value. It’s a fantastic feature that I use in nearly every app.

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [January 30, 2024, 7:09pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/4 "2024-01-30T19:09:41Z")

</div>

Set Col Value on the Table/Row you are acting upon in a Show Edit screen?

I wanted to update ‘hidden’ columns that were not accessible for editing in my Edit screen.

The Update of the row did not work until I remove the Set Col Val for the “hidden” values.

Otherwise, works great as you stated for other tables/add-rows etc.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [January 30, 2024, 7:23pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/5 "2024-01-30T19:23:56Z")

</div>

Maybe not exactly the same scenario, but I’ve ran into issues deleting rows through a relation as part of a custom action… if the relation is empty and there is nothing to delete, then the rest of the action chain fails, so I 've had to use multiple conditions with duplicates actions to account for those scenarios.

> [@My Hard Stops and Annoyances](https://community.glideapps.com/t/my-hard-stops-and-annoyances/66846/1):
>
> I perform some actions through a Single Relation, such as a Set Column Action. This action is among other actions in a custom action that sets some values in the current row as well at rows in other tables before executing a Show Detail Screen action. I noticed that the button completely disappears if one of the single relations are empty. If there are no matches in the relations, then there is nothing that to needs to be set, but there is no reason why the rest of the action sequence can’t continue to run. I still need those other actions to occur but the button completely disappears. Short of breaking a single IF branch in the custom action into 3 or 4 separate branches to account for every possible scenario, I see no reason why the entire button needs to be disabled. This was not an issue in classic apps. I did the same thing and the button still worked as expected. This is only an issue introduced with New Apps.  
> Notice the highlighted actions. The relations for those actions may or may not be empty. If they are empty, who cares…the rest of the action sequence should work, so there is no reason to hide the button that calls this custom action. I’ll have to add 3 extra branches just to account for the times that one or both of the relations are empty and duplicate a lot of logic.  
> ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/4/74c4dad8e5a35bb87c72e499c9420a4cbb95f015.png)

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [January 30, 2024, 7:44pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/6 "2024-01-30T19:44:17Z")

</div>

> [@Jeff\_Hager](#):
>
> if the relation is empty and there is nothing to delete, then the rest of the action chain fails

Pretty much what happened to me with set col vals in another use case. Worked perfectly in Classic (when it would just continue to flow past the failure) - then not working now. It was a subtle use case which I didn’t notice until…well…I did during a demo. The disappearing button has also occurred where I needed to add more branches (which I did) which seemed weird but now makes sense. Probably occurred cause I followed your philosophy/methodology 🙂

Need to re-read your Hard Stops treatise.

---

<div class="post-metadata">

### Author: ![NFNHello](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nfnhello/32/3371_2.png) [@NFNHello](https://community.glideapps.com/u/NFNHello)
#### Post date: [January 30, 2024, 9:38pm UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/7 "2024-01-30T21:38:30Z")

</div>

> [@Robert\_Petitto](#):
>
> I almost never experience issues with Form Submit

A year ago I had about a 2% failure rate of my form submit \>on submit \>set column action when I was setting columns on the data submitted in the native form.

I stopped using the combination last year. Since then, I have only used set column in the on submit for data that isn’t dependent on the form’s submission, or I’ve used a custom form.

Are you setting columns on data that was just submitted in the form?

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [January 31, 2024, 12:59am UTC](https://community.glideapps.com/t/what-happens-during-an-on-submit-function/70299/8 "2024-01-31T00:59:59Z")

</div>

I believe the answer is yes.

My On Submit did Add Rows on tables not part of the Submit (creating messages for team members) and then did a Set Col Val on the row that was “Submitted” (using an Edit Screen). The idea was to clear some temporary data in ‘hidden variables’ in the row.

The Set Col Val on “This item” caused the ‘Edit Screen’ updates to fail. I removed it and everything worked as it should. And the Glide Docs return ‘empty’ when searching for ‘On Submit’ so I figured I would query the Community.

Thanks for getting tback.
