RunObject Property
jhanvincent14
Posts: 214
can I use RunObject Property of an action button based on a condition ? thanks for the help
0
Best Answers
-
Hi,
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
Slawek Guzek - www.yitron.co.uk
Business Central, MS SQL Server, Wherescape RED;5 -
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 ?
For options under different circumstances, see Slawek's answer above.
5
Answers
-
Hi,
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.
SlawekSlawek Guzek - www.yitron.co.uk
Business Central, MS SQL Server, Wherescape RED;0 -
Hi,
Exactly, but also you can write your own code on trigger OnAction with conditions whatever you want
Regards,
Yury0 -
Slawek_Guzek wrote: »Hi,
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
oh. thanks for the tips.
i have another question, How can I get the active row of a list in navision ?0 -
Hi,
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
Slawek Guzek - www.yitron.co.uk
Business Central, MS SQL Server, Wherescape RED;5 -
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 ?
For options under different circumstances, see Slawek's answer above.
5 -
Thanks a lot guys
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions


