DictClass.callStatic Method [AX 2012]
Calls a static method.
You must create an instance of an object of the DictClass class by using a class that contains the method passed to the callStatic method. If an attacker can control the input to the callStatic method, a security risk exists. Therefore, this method runs under the code access security. Calls to this method on the server require permission from the ExecutePermission class. Make sure that the user has development rights by setting the security key to the SysDevelopment on the control that calls this method.
This example calls the AOSClientMode method in the Session class and then prints the value returned from the call.
static void Job_Example_DictClass_CallStatic(Args _args)
{
DictClass dictClass;
anytype retVal;
str resultOutput;
ExecutePermission perm;
perm = new ExecutePermission();
// Grants permission to execute the DictClass.callStatic method.
// DictClass.callStatic runs under code access security.
perm.assert();
dictClass = new DictClass(classnum(Session));
if (dictClass != null)
{
retVal = dictClass.callStatic("AOSClientMode");
resultOutput = strfmt(
"Return value of AOSClientMode is %1",
retVal);
print resultOutput;
pause;
}
// Closes the code access permission scope.
CodeAccessPermission::revertAssert();
}
Community Additions
ADD
Show: