Menu Designer - Calling a code unit function with input para

arindamarindam Member Posts: 176
Hi All,

I have written a codeunit function (fnOrder) which takes Sales Header Id and Type as in parameter and gives result as var (out).
I have created a munu item at our Sales Order Form and assigned the menu runobject to that code unit. Now I want to call my code unit's function along with the parameters.

My blocking point is i am not able to send the input and output parameters along from this Menu Designer's Runobject.

Please advice.

Arindam

Comments

  • kinekine Member Posts: 12,562
    You need to do it through code, not just properties... You can ran just Codeunit.RUN function through properties and pass the actual record. If you have own function with own parameters, OnPush is your way...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • arindamarindam Member Posts: 176
    Thank you for your inout.

    I think another way is there. I can go to the code unit of that particular menu item and write the calling code.
    I did some R&D and use these steps :

    1. I created a menu item and selected a RunObject (which is the same code unit which i have developed).
    2. Now selected the MenuItem if I clicked on the 'C/AL Code (F9)', then I was able to go to the code unit where I could write my desired calling code for the menu item.
    3. Compiled and Run.

    I hope this way we can solve the problem.

    Looking forward to your views.
  • kinekine Member Posts: 12,562
    May be I just misunderstand what you wrote, but I do not understand sentence:
    . Now selected the MenuItem if I clicked on the 'C/AL Code (F9)', then I was able to go to the code unit where I could write my desired calling code for the menu item.

    If you are on form and on the menuitem, and you press F9, you are in code of the form, not of the codeunit... #-o
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • arindamarindam Member Posts: 176
    Sorry for that.

    I meant to say, Go to Menu item, then select the particulat menu where you want to write code. Then go to the code window of that particular menu (not any code unit). There you can write the code which you want to execute on menu click at run time.

    By 'C/AL Code (F9)' I mean the last button at upper menu bar of Navision along with Tools, Properties etc.
  • kinekine Member Posts: 12,562
    It means that you wrote the code into OnPush trigger of the menu item and this is what I suggested... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • arindamarindam Member Posts: 176
    Yes exactly. On Push event.

    Thanks for your input once again.
Sign In or Register to comment.