web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

X++ element.args().caller() can not get any result

(0) ShareShare
ReportReport
Posted on by 113

hello,gusys, i use element.args().caller()  can  not get the object .but  in  ax2009  i  can  get result .could you tell  me  why?  pastedimage1680160127722v1.png

I have the same question (0)
  • GirishS Profile Picture
    27,833 Moderator on at

    Hi Tracy,

    Add the myBatch buffer into watch window and see if there is any buffer values is passed.

    Is myBatch buffer is a class?

    Are you calling the form from a class?

    Have you passed the parmAccount() value?

    Thanks,

    Girish S.

  • Tracy wang Profile Picture
    113 on at

    yes   i  calling  the  form  from  a  class   the  paramAccount method  like  this .  

    public  CustAccount paramAccount(CustAccount  _custAccount =custAccount)

       {

           custAccount =_custAccount;

           return custAccount;

       }

  • Martin Dráb Profile Picture
    238,865 Most Valuable Professional on at

    It seems that this particular form wasn't called with a caller.

    If you think it's a bug, look at how the form is called. Or you'll need to correct your expectations.

  • Martin Dráb Profile Picture
    238,865 Most Valuable Professional on at

    What you have in paramAccount() is irrelevant. It can't be called, because you have no object to call it on. You got the error because you're trying to call paramAccount() on a variable that contains null.

  • GirishS Profile Picture
    27,833 Moderator on at

    As martin told there is no object on the "myBatch" class buffer, that's why I asked you to add that buffer to watch window and check.

    Thanks,

    Girish S.

  • Tracy wang Profile Picture
    113 on at

    yes ,but  why  we  can  init  the myBatch object?

  • GirishS Profile Picture
    27,833 Moderator on at

    If you want to init the myBatch object dont use element.args().caller() - This will return the object that is called from.

    If you want to initialize myBatch class, use new keyword to create object for the class, but you won't get customer account as per your scenario.

    Thanks,

    Girish S.

  • Tracy wang Profile Picture
    113 on at

    ok,but  in ax2009  i can use  element.args().caller().however ,i use new(),the custAcoount can not  get  value  ,System  tell m e  i  need  to  use   static   to define   custAccount

  • Martin Dráb Profile Picture
    238,865 Most Valuable Professional on at

    You're wrong in thinking that element.args().caller() always returns a value. It returns an object set as the caller when opening the current form. It's often empty, e.g. when you open a form from main menu.

    The caller is set automatically when a form or a class is opened from through a menu item button on a form and it might (but doesn't have to) be set when a form is opened from code.

  • Tracy wang Profile Picture
    113 on at

    pastedimage1680164833762v1.pngthe  first  picture   i  defined  without  static  .the  second  picture i  defined  with  static   ,now  the custaccount  have  value pastedimage1680164980541v2.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 527 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 473

#3
Adis Profile Picture

Adis 284 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans