Can't access to trigger's C/AL Code

mparsymparsy Member Posts: 13
Hi everybody,

I'm facing an issue which is very weird to me. I can see the C/AL code executed by the 'On Push()' trigger of severals buttons when I'm in debug mode, but once that I'm trying to access it using the C/AL editor in order to make some modifications, the 'OnPush()' code line is empty :shock:
I have a section for each trigger like 'OnValidate()', 'OnPush()', Etc., But each of them is empty.

I don't know if this issue is related with this Topic: http://www.mibuso.org/forum/viewtopic.php?f=23&t=38517&sid=966bd734c468abd8f03603798894c633

Do somebody have already faced that before?

I don't think is a right problem because I'm super user of my base.

Answers

  • matttraxmatttrax Member Posts: 2,309
    It could be, but first make sure you're in the right object. Write down the stack trace of objects and function calls and follow it manually. Odds are you're probably in a different form than the debugger is showing you.
  • kapamaroukapamarou Member Posts: 1,152
    mparsy wrote:
    I have a section for each trigger like 'OnValidate()', 'OnPush()', Etc., But each of them is empty.

    Is there any chance the code you see is in different objects?

    Maybe the button does not have any code but runs an object through options (actions) in it's properties.

    Just make sure this isn't the case before you go looking in other places...
  • mparsymparsy Member Posts: 13
    First, Thanks Both of U matttrax and kapamarou for your quick answers.
    It could be, but first make sure you're in the right object. Write down the stack trace of objects and function calls and follow it manually. Odds are you're probably in a different form than the debugger is showing you.
    I checked this and I'm really in the same Form the debugger is showing me.
    Maybe the button does not have any code but runs an object through options (actions) in it's properties.

    Just make sure this isn't the case before you go looking in other places...
    Precisely, that's the problem. I'm actually working on a MenuItem 'OnPush()' Trigger. But When I'm looking in the Menu Designer this MenuItem don't have any Action or RunObject.

    When I'm clicking this MenuItem the debugger puts me in the
    <Control1000000084> - OnPush()
    
    section of the same Form that I'm working on in design Mode. But in design mode there's no sign of this section. They also isn't any code for the MenuButton's C/AL Code the MenuItem belongs to. I only have 2 empty sections (<Control1000000023> - OnActivate() and <Control1000000023> - OnDeactivate()).
  • kapamaroukapamarou Member Posts: 1,152
    Aren't you going to Menu -> Right click -> Menu Items?
    OnActivate() and OnDeactivate() belong to the menu button but

    OnPush() belongs on the menu item of the menu button.
  • mparsymparsy Member Posts: 13
    Aren't you going to Menu -> Right click -> Menu Items?
    Yes that's what i've done. Once I'm in they aren't any ShortCutKey, Action, or RunObject for any of the MenuItems of this MenuButton.
    OnActivate() and OnDeactivate() belong to the menu button
    Yes. That's when I access the Right click ->C/AL Code of this MenuButton
    OnPush() belongs on the menu item of the menu button.
    I wish I could access it :? lol. I can see this code only in the debug mode and I don't know how to find it (Does it exist a Right click ->C/AL Code thing for MenuItems?? :?: )
  • kapamaroukapamarou Member Posts: 1,152
    Control1000000084 is what you see in the debugger.

    Try and export your form in Text and search for Control1000000084 to see what it is.

    Could it be a hidden control?
  • mparsymparsy Member Posts: 13
    Control1000000084 is what you see in the debugger.
    Exactly :D
    Try and export your form in Text and search for Control1000000084 to see what it is.
    There's no occurence of Control1000000084. (I think that by "export your form in Text " you mean export the C/AL code? Otherwise I can I do that?)
    Could it be a hidden control?
    No this Form don't have any hidden control
  • kapamaroukapamarou Member Posts: 1,152
    mparsy wrote:
    (I think that by "export your form in Text " you mean export the C/AL code? Otherwise I can I do that?)


    By going to the Object Designer, selecting the form and going to File -> Export and selecting Text Format.
  • mparsymparsy Member Posts: 13
    By going to the Object Designer, selecting the form and going to File -> Export and selecting Text Format.
    I didn't know this feature. I think It'll be very helpfull for me. Thanks.

    I search for 1000000084 and I find the code that I can see In the debug mode (The code between BEGIN and END). It's something like that:
    Menu=MENUITEMS
                                     {
                                       { ID=1000000084;
                                          CaptionML=FRA=Valider Affaire;
                                          OnPush=VAR
                                                          CodeUnitValidate@1000000000 : Codeunit 50016;
                                                          BEGIN
                                                            COMMIT;
                                                            SLEEP(100);
                                                            CLEAR(CodeUnitValidate);
                                                            CodeUnitValidate.DoWhatINeed(1,"Stuff Nb",0);
                                                          END;
                                        }
                                     }
    
    (not the real code variable names have been changed for this example)
  • kapamaroukapamarou Member Posts: 1,152
    Show there is a MenuItem on a MenuButton. If you press F9 on the menuitem then you should this this code... Do you? :-k
  • mparsymparsy Member Posts: 13
    The problem is that I can't access to the MenuItems from Design mode. I can only have F9 pressed on the MenuButton. Is that the normal behavior??? :?:
  • mparsymparsy Member Posts: 13
    mparsy wrote:
    The problem is that I can't access to the MenuItems from Design mode. I can only have F9 pressed on the MenuButton. Is that the normal behavior??? :?:
    My apologies! :oops: I answered too quickly.
    I have access to the code at least :oops: From the MenuItem Window you select the MenuItem that you want and you press F9.
    Thanks for your precious help. I was trying to do à "right click" thing but never thought to simply press F9 :oops:

    I'll try this to the others buttons and keep you up to date.
    [edit]It works for the others buttons. Thank you for your support.[/edit]
Sign In or Register to comment.