DictClass.Callstatic(String, Object[]) Method

Definition

Calls a static method.

public:
 virtual System::Object ^ Callstatic(System::String ^ _methodName, cli::array <System::Object ^> ^ varArgs);
[Microsoft.Dynamics.Ax.Xpp.VarArgs]
public virtual object Callstatic (string _methodName, object[] varArgs);
[<Microsoft.Dynamics.Ax.Xpp.VarArgs>]
abstract member Callstatic : string * obj[] -> obj
override this.Callstatic : string * obj[] -> obj
Public Overridable Function Callstatic (_methodName As String, varArgs As Object()) As Object

Parameters

_methodName
String
varArgs
Object[]

Returns

An anytype data type value that is returned by the specified method.

Attributes

Remarks

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(); 
}

Applies to