RunObject Action

DnealDneal Member Posts: 103
Hi,

I am trying to modifiy a posting routine in a timejournal. I want a report to print after the posting codeunit has been successfully executed.
Currently the post button uses the Action = RunObject and RunObject = Codeunit Time Jnl.-Post. However I want to remove these and run the codeunit through C/AL instead. This way I can find out if the codeunit executed successfully, if so I can print out the custom report.
This is what I'm trying to run:

Ok := CODEUNIT.RUN(14020041,TimeJournal);

I get an error stating that I can't convert from boolean to integer, even though Help is indicating this should work. I'm obviously not understanding something.

But when i try to run:

CODEUNIT.RUN(14020041,TimeJournal);

I'm not getting the same result has I did when I allowed the codeunit to run using the action and runobject. How do I know what this filters to so I can get it working exactly the same way?

I'm new with codeunits, and a little confused even has I try to explain. Any advice is welcome.

Thannk you,
DNeal

Comments

  • kinekine Member Posts: 12,562
    May be problems is the second parameter. The record must be filtered to what you want to post. When started through RunObject the Rec is used...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DnealDneal Member Posts: 103
    Hi,

    Thanks for the response. It helped me realize what it was I needed to do. I was using the Variable of a record. I should have been using rec instead, like you indicated was being used in the RunObject.

    My statement ended up looking like this:
    CODEUNIT.RUN(CODEUNIT::"Time Jnl.-Post",Rec);

    Thanks again!
Sign In or Register to comment.