Calling a Codeunit from Dataport and pass a variable as rec

smnnekhosmnnekho Member Posts: 3
edited 2011-07-05 in Navision Financials
Hi,

i do know navision (from a users point of view) quite well, but have no knowledge of C/AL whatsoever (unfortunatly)

I've written a .net application which (amongst user things) would allow the user to automatically complete components etc.

Right know this is done via a dataport (my application collects the data, provides the csv, opens a production order and calls the dataport vie a send-key shortcut for a button i put on the form. this is actually pretty failsave)

However, for "post components" i do pretty much the same thing - but i'm not really happy with the keysendstuff to post a lot of components. (though it works 90% reliably and i have some failsaves built in).

That is why i would really like to run the specific codeunit after the dataport is processed. i know WHERE and even more or less HOW to do it. What i do not know is how to pass the neccessary REC-value (Production header --> No., optionally multiple ) the importet dataport to the codeunit.

Can anybody help me? a rough hint would be nice, i'll try to digg in there myself then.

Thanks in Advance!

Comments

  • prototyperprototyper Member Posts: 70
    A rough example on how to do this :-

    Create a function in the codeunit that has the production order as a parameter.
    In that use the passed in parameter to get the production order and do your stuff.

    Call this function from the dataport (perhaps one for each order).
    Sleep on it... The best solutions come at 2am
  • smnnekhosmnnekho Member Posts: 3
    prototyper wrote:
    A rough example on how to do this :-

    Create a function in the codeunit that has the production order as a parameter.
    In that use the passed in parameter to get the production order and do your stuff.

    Call this function from the dataport (perhaps one for each order).

    i cannot change the codeunit (and if i could i wouldn't be able to do it properly (; )

    but the codeunit already has the parameter.

    My question is a) how to pass the parameter with the codunit.run command (i guess i have to declare a global variable with type record?)

    b) how to tell the dataport to use the appropriate fields from the imported data for the codeunit parameter.
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    smnnekho wrote:
    My question is a) how to pass the parameter with the codunit.run command (i guess i have to declare a global variable with type record?)
    http://msdn.microsoft.com/en-us/library/dd301214.aspx
    smnnekho wrote:
    b) how to tell the dataport to use the appropriate fields from the imported data for the codeunit parameter.
    Of course you should fill your record fields with the values you want to use.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
Sign In or Register to comment.