hello,gusys, i use element.args().caller() can not get the object .but in ax2009 i can get result .could you tell me why?
if i defined the custAccount with out static keyword ,i can not get value ,but if i use static key word i can get ,
What code you should write depends on what want to achieve. Unfortunately, you told us nothing about it, therefore we can't give you any concrete solution.
You can use new method to instantiate object for the class. But check whether you are able to get customer account value.
Thanks,
Girish S.
so you means the best way is use new()?
Static method doesn't need any object reference to call. You can directly use scope resolution operator to call the static method. Like ClassName::MethodName();
Also, you are showing the screenshot for the class, But the error is throwing at form level where you didn't get a caller object.
Thanks,
Girish S.
the first picture i defined without static .the second picture i defined with static ,now the custaccount have value
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.
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
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.
yes ,but why we can init the myBatch object?
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156