Code unit call from Menu Item

arindam
Member Posts: 176
Hi All,
I am stuck on an issue - Senario
I have written a code unit, which takes Sales header Id as input parameter. Now I want to call that code unit from Order/Invoice form. I have created a Menu Item at Order button of 'Order' form called 'Call my Code'.
Now I want to call my code unit from this menu item and need to pass Header Id as parameter. Please not, I have created a function in the code unit and I want to run that function. I dont want to call 'RUN' method of the code unit.
Please help.
Thanks in advance.
Arindam
I am stuck on an issue - Senario
I have written a code unit, which takes Sales header Id as input parameter. Now I want to call that code unit from Order/Invoice form. I have created a Menu Item at Order button of 'Order' form called 'Call my Code'.
Now I want to call my code unit from this menu item and need to pass Header Id as parameter. Please not, I have created a function in the code unit and I want to run that function. I dont want to call 'RUN' method of the code unit.
Please help.
Thanks in advance.
Arindam
0
Answers
-
Hi Arindam,
you call your codeunit as followsCLEAR(MyCodeUnit); MyCodeUnit.MyFunctionName(SalesHeader,"no.");
Hope this helps0 -
Thanks for your reply.
Where shall I write this code. I want to run my code unit from the menu.
For example -
In Order form's Order button we have a list of menus (List,Statistics etc....). Here I have created a menu item. Now I want to run my code unit on click of that particular menu.0 -
C/AL Code in the OnPush of your menu button.
Albert0 -
Here I am not using general button. I am using Menu Button. I am not finding any OnPush event for Menu Button.0
-
I have written the code at OnPush event but still it is not firing the event.0
-
Hi Arindam,
Go to your new Menu Item and press F9 or click View-> C/AL Code and
you will see the OnPush and put your code there.
Albert0 -
Hi Arindam,
Use thisCU.FUNC("No.");
where CU is the codeunit, FUNC is the function defined by you and No. is the sales header/sales document No.Diptish Naskar
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/0 -
Thank you Albert and Diptesh.
Your solution solved my problem.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions