Call any method of class in D365 FO x++
public anytype callClassMethod(ClassId _classId, MethodName _methodName, boolean isInstanceMethod, Common _record)
{
anytype returnObject;
SysDictClass dictClass = new SysDictClass(_classId);
if(isInstanceMethod)
{
returnObject = dictClass.callObject(_methodName, classFactory.createClass(_classId), _record.TableId, _record.RecId);
}
else
{
returnObject = dictClass.callStatic(_methodName, _record.TableId, _record.RecId);
}
return returnObject;
}
Example:
public str getApproverNames(Common _record)
{
str name;
name = this.callClassMethod(className2Id('DSSWorkflowUtil'), 'getApproverNames', true, _record);
return name;
}
Comments
Post a Comment