runBuf Function [AX 2012]
Updated: June 29, 2011
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Executes the specified X++ code that is passed as a string.
anytype runBuf(str job,[anytype param])
If an attacker can control input to the runBuf function, a security risk exists. Therefore, this function runs under Code Access Security. Calls to this function on the server require permission from the ExecutePermission Class.
The following example calls this method to run the contents of the supplied buffer. When this code is run, the integer 49 is sent to the print window.
void RunBufExample()
{
str myJob = "int myfunc(int i) {return i+7;}";
ExecutePermission perm;
;
perm = new ExecutePermission();
if (perm != null)
{
perm.assert(); // Assert the use of the dangerous API RunBuf.
print runBuf(myJob, 42);
pause;
CodeAccessPermission::revertAssert();
}
}
Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).
Community Additions
ADD
Show: