The active row on a list, while it is displayed, is always in Rec. If you need the active row from within the page, just use Rec. If you need it from an external object, create a global function that returns Rec or it's primary key and call that function. To do that you need to declare the page as a variable and open it from this variable; or if it is a subpage (Part) you can find and call it through CurrPage.jhanvincent14 wrote: »i have another question, How can I get the active row of a list in navision ?
Answers
If I understood correctly you want RunObject to run different objects depending on some condition.
Unfortunately this is not possible.
RunObject always links to one object, its type and id are assigned when you desing the action, and cannot ba changed at runtime.
But - you can have two actions with the same captions, with visibility controlled by your conditions, each action linked to a different object via RunObject property.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Exactly, but also you can write your own code on trigger OnAction with conditions whatever you want
Yury
oh. thanks for the tips.
i have another question, How can I get the active row of a list in navision ?
There are a few ways.
You can delcare the page in some PageVar, run im and when RUNMODALL call returns use PageVar.GETRECORD(recvar), or you can also use PageVar.SETSELECTIONFILTER(recvar) and (then recvar.FIND() )
If you run the page without declaring a page variable, using the PAGE.RUNMODAL(pagenumber, recvar), then after the page is closed the recvar points to an active record.
In all cases you need to check that user actually selected some record.
Unfortunately you need to use code to open the page to be able to get back an active record. You cannot get an active record off the page opened using a link (RunObject property)
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
For options under different circumstances, see Slawek's answer above.