Use LINKTOFORM to re-open Form View only when saving new records

Hello all,

Quick question: What would be the best way to set up an action to just fire when the record saved is new?

I'm trying to configure an Open New Form on Save action to re-open the form only when adding a record and not when updating one. The idea is to make recording new information, that usually comes in bulk, easier by re-opening the form, but not when updating records that generally happens very few times and having to cancel the form might get annoying.

I have a LINKTOFORM action selected under the Save Behavior of the Form View with somewhat of a working configuration. But I'd like to see what more experienced users suggest.

Thanks in advance! 

Solved Solved
0 9 1,695
1 ACCEPTED SOLUTION

I see, in that case I would separate New and Update Forms altogether.  Typically to add a new row you use the "+" button.  To update a row you tap a row or use the Edit button.

For your use case, when you tap the "+" it goes to its normal Form and then on Form Save of THAT Form have it navigate back to itself.

However, for Editing of an existing row then intercept the Edit action to go to a custom Edit Form.  If you just add the new Form, the "+" button will begin to use it instead of the default, so the trick here is to create a Slice, give it a name and set the filter criteria to "TRUE".  Now you can create a view on this Slice as a different datasource  and it won't interfere with the System actions.

Next, depending on how you Edit the rows, you would intercept the Row Selected actions on Table and/or Deck views (if you wish to go straight to Edit) OR create a custom Edit action to navigate to your Edit Form and show it instead of the system action, along the lines of what @TeeSee1  was suggesting (I guess he was a couple steps ahead).

View solution in original post

9 REPLIES 9

Could you elaborate. Is the LINKTOFORM() on the same table as the first "Saved" form or on different table? Any columns from the first "Saved" form being popultaed in the second LINKTOFORM() form?

Also could you elaborate what you mean by "somewhat of a working configuration. "  

 

Yes, the LINKTOFORM() opens a Form to the same table pre-populated with some fields. What I want is to have something work like the Auto Re-Open option for a form view but only when adding records, not when updating.

Hamlet_0-1644514202387.png

The way I have it right now is just with this formula as the condition for the LINKTOFORM()

[fechaCreado] >= (NOW() - "000:02:00")

I have the LINKTOFORM() action selected on the Form Saved Event Action. Since there's a field that already records the time when the Form was saved ( Initial Value as NOW() ), I just check if it has been less than 2 minutes from now. That way if they open the Form again later on to update the record, it won't re-open on save.

One way to do what you want would be to create a new form that does not automatically re-open.

And then Hide the sys generated ADD, EDIT buttons, and create your own ADD, EDIT buttons to open the appropriate form using APP: Go to another view within this app with LINKTOFORM(ADD) and LINKTOROW(EDIT) respectively.

You also need to manage where you display your newly created buttons by setting  (CONTEXT("VIEW") + "select appropriate view")

There is another way to control which form to open. (see this Q&A) This involves creating a new slice so maybe an overkill here.

Hope this gives you a few other options to mull over.

We cannot add buttons to a Form view itself.  The ask was to navigate to another Form view IF the row saved is New.

I am not suggesting to add a button to a form view.

I meant to create buttons to go to forms

This button takes you to a system generated Form(=T1_Form) with auto repeat

TeeSee1_1-1644523648948.pngTeeSee1_2-1644523767856.png

This button attached to a Detailed view takes you to a newly created form (=T1 Edit Only) without auto repeat

 

 

TeeSee1_3-1644523816181.pngTeeSee1_4-1644523835276.png

This did actually work quite nicely when I tested it.

 

 

What I would do in this circumstance is create a Status column and set the Initial Value to "New" or a New? flag initialize to TRUE.  Then in your Form Save behavior set of actions you can inspect this Status to decide when to launch the second Form. 

Now here's the rub, in a set of actions, any action that navigates away from the normal execution flow will prevent any additional actions from executing SO an action that navigates to another view MUST be the last action in the set/group.

This means you have to be a bit crafty about when to update the Status column to some value other than "New"/TRUE.  I'll leave that to you but please come back and ask if you need help.

On another note...

Can you explain what your use case is?  Maybe there is a better way to reach your goal altogether.

Thanks for the reply. For setting up your suggestion, I would just leave it as it is and check to see if the record was created recently or not.

The use case is a Payroll App. Users need to record changes in the payroll like extra time, incentives, sales commissions, deductions, etc. So they usually do this in bulk one after the other. I figured that the Re-Open on Save was perfect for this. Except when they need just to update a record to change a field that they got wrong or something. Mind you, having to cancel on the re-opened form after saving the updated record is not too big of a deal, but hey, it presented a challenge... so challenge accepted!

I just wanted to see if there was a better option or maybe even a chance for a feature request/idea to have the Re-Open on Save be activated for ADDS, UPDATES or ADDS_AND_UPDATES. Maybe a change counter column could also do the trick... 

I see, in that case I would separate New and Update Forms altogether.  Typically to add a new row you use the "+" button.  To update a row you tap a row or use the Edit button.

For your use case, when you tap the "+" it goes to its normal Form and then on Form Save of THAT Form have it navigate back to itself.

However, for Editing of an existing row then intercept the Edit action to go to a custom Edit Form.  If you just add the new Form, the "+" button will begin to use it instead of the default, so the trick here is to create a Slice, give it a name and set the filter criteria to "TRUE".  Now you can create a view on this Slice as a different datasource  and it won't interfere with the System actions.

Next, depending on how you Edit the rows, you would intercept the Row Selected actions on Table and/or Deck views (if you wish to go straight to Edit) OR create a custom Edit action to navigate to your Edit Form and show it instead of the system action, along the lines of what @TeeSee1  was suggesting (I guess he was a couple steps ahead).

Yep, this makes sense.

Leave the ADD buttons the same as original so that they point to the Table and the system generated Form View that would Re-Open on save. Then hide the system generated EDIT button and make my own, so that it navigates to the row selected but in a Slice with it's own Form View.

Thanks all for helping out!

Top Labels in this Space