Tag: CodeAccessPermission

  • Dynamics Ax modifying CreatedDateTime

    For testing purposes with the MRP we needed to modify the createdDateTime fields in Dynamics Ax 2009. Since these are system fields we needed a workaround. if(isRunningOnServer() && CurUserId() == “Admin”) { new OverwriteSystemfieldsPermission().assert(); salesLine.overwriteSystemfields(true); // “YYYY/MM/DD HH:MM:SS” salesLine.(fieldnum(SalesTable,CreatedDateTime)) = str2datetime( “2010/04/03 11:00:00” ,321 ); salesLine.doInsert(); salesLine.overwriteSystemfields(false); CodeAccessPermission::revertAssert(); } Remarks: Since this code is pretty…