Ledger Entries - Direct Link

Can anyone help on the below?

From the Ledger Entries screen, clicking on a particular transaction line should open the Posted Sales Invoice form with the invoice details.



There are no specific events for this (Click or DblClick), I think using a shortcut key will be your best choice !!

Do you need a function to do this very often?
The standard way would be to use NAVIGATE. But this would be four mouse clicks from e.g. the G/L Entries to the posted sales invoice…

We also need the same, but the problem as you mentioned is the standard way takes 4 clicks, is there a way to create a short cut key or a button to make this possible in one step.


Yes, of course you can, it’s easy.

When you edit a Menu Button you can define many Menu Items, each one with a shortcut key and much more… if you don’t want this Menu Item to be accesible through the Menu Button but for the shortcut just make it not visible :wink:


We managed to get the link by creating a button and setting its properties to link the No. in the Posted Invoice Form to the Document No. in the Cust. Ledger Form.

When clicked on the button it takes us to the select invoice card.

Now the challange is when we try to add the ‘Customer Ledger form’ as a SUBFORM to the main Customer Form, it displays the ledger entries in the same screen fine but when clicked on the Invoice card there (present in the sub form) it gives the following error.

A value in the filter ‘AHRAM UN P.CODE.11511’ in the No. field in the Sales Invoice Header table is too long for the field type.

Type: Code20

The value it picks up is from the Address2 in the Main Customer Form.

Can you please help us out here.


Also in addition to the above how can we change the action of the button to use the “Credit Memo Form”, when selected a credit memo ledger entry in the list.


Just using the “Document Type” field…

if “Document Type” = “Document Type”::Invoice then //invoice form code
else if “Document Type” = “Document Type”::“Credit Memo” then //credit memo code

So easy, isn’t it?

Please pardon our ignorance but right now we are calling the RunObject ‘Posted Sales Invoice Header’ from the properties that is set for the button.

Can you please let us know how we can call it from the code instead of using the button properties.

We are very new to Navision and are still in learning stages.

You help is appreciated. Also, can you please shed some light on the error we are get when we add the Cust Ledger entry as a sub form to the Customer Form. Couple of posts above we have explained the error.


Also, how can we get the Document No. (from the record selected) and pass it to to the RunObject as a parameter to open the corresponding card.

There is no need to apologize, I still remember when I started with NAV just a year ago.

First I want to say is that I give a possible solution, more experienced developers (David, Nuno, Joerg and many others) could surely give a better solution and even correct mine.

If you want to run different objects from the same Menu Item you should select the Menu Item and press “C/AL Symbol Menu” or F5 to display the different triggers you can programme. You’re starting but I suppose you know a few C/AL language, if not, take a look to declare record vars and form functions (FORM.RUN, FORM.RUNMODAL). A solution to your problems could be:

InvoiceHeader (record var to table 112)

if “Document Type” = “Document Type”::Invoice then
InvoiceHeader.get(“Document No.”); //to get the invoice of the record selected on the form
Form.Run(Form::“Posted Sales Invoice”, InvoiceHeader); //this would display the Invoice Form with the invoice selected on InvoiceHeader var

Anyway you should take the developer’s guide and try to accomplish and learn NAV language and logic. Ufffff, you know what I mean? [8-|]

Thanks for your input mate. With some reference to the documentation and help of your code, It worked perfectly fine.

Is there possibly a way to achieve this without using global variables?

Appreicate your support. Yes, am actually planning to do some sort of training for myself. Is there any good documentation on the net that you can refer to.


Yes, the way I put the code SalesHeader record var could be a local var. In your Menu Item just go to View → C/AL Locals.

Documentation… with your NAV you should have received many pdf files with end-user and development training/documentation. I don’t know if you are working with NAV 4 or 5, anyway try searching on your cd or ask your partner [:)]