two posts at the same time, as you can see I’m quite new in NAV…

I’ve created a function on a form, it only creates a new record, set a few data and then show the form (type Card) with the record I’ve just inserted. The code is like this:

reg.INIT; reg.Name := ‘test’; reg.INSERT; FORM.RUN(50001, reg);

…this inserts so good the new record but doesn’t show me the form with it. I’ve tried too with:


…but same thing. I can’t understanding, I do the same (upper line) in other form and works right.

¿? [:|]

Try a RUNMODAL instead of a RUN.

The negative is that you need to do a COMMIT before the RUNMODAL. (try without a COMMIT and you will see why [;)] )

You’re right, it works with COMMIT and RUNMODAL. But I can’t understand why having the same code and same variables on a pair of forms, it works different. For example…

RUNMODAL → I got one form (form1) and with a command open another (form2), the normal way would be that I couldn’t access the form1 while form2 is open. I got the same code in two forms and one doesn’t allow me to select the background form (form1) but the other allows me !!

RUN → same example below (form1, push command → form2). Close form1 and sometimes automatically close form2 too but not another

Anybody is happened the same?[:|]

It was the way your programmed it.

INSERT and then FORM.RUN runs the form and then continues with the command after the FORM.RUN and the transaction started by INSERT (or before it) is still active. So it is quite unsure what happens.

With INSERT and then COMMIT and then FORM.RUNMODAL. You commit the transaction, then you open the form. And only when you have closed the form, Navision continues with the code after the FORM.RUNMODAL.

Good, but the first way you tell me (INSERT and then FORM.RUN) should show the form, but not always do. I got in a command exactly the next code…

codForm := codFormLaunch;
codReg := codRegLaunch;
FORM.RUN(50004, recordA);

This creates the new record but doesn’t show the form 50004. But it works with the COMMIT after INSERT and RUNMODAL instead of RUN. [:(]

I think your form 50004 is hidden AFTER your original form.

PS never use FORM.RUN(50004,…). Use FORM.RUN(FORM::“The Form”…). This serves for future merges or to know where a certain object is used.

I agree with you, I can see how the form is opened and closed inmmeditely. I don’t know why but… I resign myself.

I will trye to use FORM::“The Form”…

Thank you so much !!

Hi Carlos,

The topic of your post mentioned basics, so let me address that.

The fundamental core to these two commands, is connected to how the version principle works, and what COMMIT does.


This command basically launches a FORM as a new process. The form runs on its own, and looks at the current Btree to see what Version it is using. Any data changes made in that form are committed following the normal rules of Navision. BUT the task the launched the form has no connection at all to this one, so you can not pass parameters to the form, nor get them back by simple means. If you have ten lines of code, and line 5 is a RUN.FORM command, then the form runs, and control immediately goes back tot eh calling routine, which then continues to run.


When you run Modal, the system considers the Form as a part of the current transaction. This means that you need to finalize the current transaction (COMMIT the Version) you are on so that the form can open. When the form opens, the calling code stops and waits for you to return control. Navision requires you to put a COMMIT in the code before the form opens. Logically this is unnecessary, since an assumed commit is there anyway when the form Opens, BUT this is required, so that the programmer consciously knows that they are working in a Version that needs to be committed. If there have been no modifications to the current version set, then the commit does not matter. Once the Form is closed by the user, control is passed back to the calling routine, and that routine can use data from the Form.

It is very important that a developer uses the correct caller, AND that they know why they are calling in uncommitted or MODAL.