Plz somebody tell me how to accomplish such an issue
*This post is locked for comments
Announcements
Plz somebody tell me how to accomplish such an issue
*This post is locked for comments
Hi Iulian,
you 'have' exactly the point. Like It!!!!!
But 'this question' is some kind of playground. Think of themes like CIL generation, pCode generation ....
Think MS has to do something here.
regards
Douglas
Hi Douglas,
I completely agree with you - some of the areas, like this, can be improved from a documentation point of view, and my example (explicitly inserted) was just to show the proper way.
As I think we can all say, from our dev. experience, that what the framework automatically enforces for actions triggered from UI by the user (like clicking a button using a Menu Item), will not be checked/enforced when calling the same programmatically. So, the answer would be that for sure the framework (going through the super() call like the one you are referring to) is doing more, but it's not a clear answer for sure.
Hi Julian,
my concern about the security apply to the usage of such MenuFunctions without the additional call to '&& menuFuntion.checkAccessRights()'
This will work for sure.
I think the really most important unknown (to my knowledge) question is:
Which code, for example, is executed on a MenuItemButton, attached to such an action MenuItem, in reality?
Means: What does the super() call of the clicked method do exactly?
Is it only the code from you or somethig more.
Btw: The SystemClasses in Ax are the most undocumented one - belonging this kind of questions.
Especially from X++ code: What is exactly (and how) checked facing security under which conditions. This information seems to be a little bit underdesigned.
Maybe noone should it know.
regards
Douglas
As Douglas was mentioning the possible security check would be the difference from calling the class directly.
MenuFunction menuFunction;
Args args = new Args();
args.record(_arecord);
menuFunction = new MenuFunction(menuitemActionStr(MenuItem), MenuItemType::Action);
if (menuFunction && menuFunction.checkAccessRights())
{
menuFunction.run(args);
}
Hi Codehunter,
the link given by Sohaib, lists the way using instantiating a menuFunction und a run().
But a Action MenuItem with a ObjectType of Class does (nearly) nothing else than calling the static main method on the assigned class.
The call of a class using a menufunction is synchronus, so you can also call the main function of this class from your code, passing the same args as to the menufunction.
Advantage of using the menufunction could be - I'm not sure - the security.
Don't know if this is evaluated during a call via x++ code? But maybe....
Never checked that.
regards
Douglas
if you want to call a menu item by x++ code, it should be irrespective of where you are calling I mean in a class or job or anywhere you have to write the code in same way
dynamicsuser.net/.../255746.aspx
note: I am not sure what you are trying to do by calling an action menu item inside a class, which seems little unusual
Mohamed Amine Mahmoudi
100
Super User 2025 Season 1
Community Member
50
shanawaz davood basha
6