Calling a procedure from a codeunit on action button

I've have multiple procedures in a codeunit and i want to call a certain procedure OnAction button in a page.
trigger OnAction();
var
<Var> : CodeUnit <CodeunitName>
begin
<Var>.<FunctionName>;
<Var>.Run;
end;
what I'm it doing wrong?

Best Answer

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Statement <Var>.<FunctionName>; calls function FunctionName

    Statement <Var>.RUN; calls OnRun trigger of the <Var> codeunit
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • CryptonicCryptonic Member Posts: 11
    So what's the correct form to do it ?
  • JuhlJuhl Member Posts: 724
    Depends on you want to run your own function or the OnRun function.
    Follow me on my blog juhl.blog
  • CryptonicCryptonic Member Posts: 11
    I want to run one of the functions in the codeunit
  • JuhlJuhl Member Posts: 724
    Then Slaweks first line
    Follow me on my blog juhl.blog
  • CryptonicCryptonic Member Posts: 11
    I tried it and it didn't work when i click on the button nothing happen
  • CryptonicCryptonic Member Posts: 11
    BlackTiger wrote: »
    Just open and read NAV development tutorials. Or quit NAV development for good. Don't thing software development is a right choice for you.

    How about if you have something helpful to say go ahead and say it if you don't just SHUSH
  • CryptonicCryptonic Member Posts: 11
    edited 2019-02-04 Answer ✓
    .
  • CryptonicCryptonic Member Posts: 11
    Btw the problem was related to nav cannot execute al code on role center it cancel the modifications on runtime soi thought i was doing something wrong and you don't have to be and ass about it.
  • lubostlubost Member Posts: 611
    You asked about calling function in codeunit from OnAction trigger. This does not interfere with page type. If you don't remember basic calling procedure, you should ask programmer to do it before data damage by wrong code.
  • CryptonicCryptonic Member Posts: 11
    > @lubost said:
    > You asked about calling function in codeunit from OnAction trigger. This does not interfere with page type. If you don't remember basic calling procedure, you should ask programmer to do it before data damage by wrong code.

    My code was right if you check the first post but if you open Microsoft nav forum you can see their comment about addig al code to role center page.
  • lubostlubost Member Posts: 611
    If you want to use code, you should use it in activities page contained in role center page.
Sign In or Register to comment.