AX – D365FO – Request for the permission of type ‘SqlStatementExecutePermission’ failed.

While running one Job , where I was trying to execute one SQL statement in AX, I got the below stack trace : Request for the permission of type 'SqlStatementExecutePermission' failed.(S)\Classes\SqlStatementExecutePermission\demand(S)\Classes\Statement\executeQuery(C)\Jobs\test - line 21 So what is the solution for this , Very simple , we need to run this job on Server , So … Continua a leggere AX – D365FO – Request for the permission of type ‘SqlStatementExecutePermission’ failed.

AX – D365FO – Executing a direct SQL statement

This recipe will demonstrate how to execute direct SQL statements. We will connect to the current Dynamics AX database directly using an additional connection and will retrieve the list of vendor accounts. How to do it... Open AOT, and create a new class called vendTableSql with the following code: class VendTableSql { } server static void main(Args … Continua a leggere AX – D365FO – Executing a direct SQL statement

AX – D365FO – “Unretrieved” value in the table field

"Unretrieved" fields are newly created fields which AX 2012 AX by error treats badly. It may also appear if a form query does not contain a field in the datasource field list. Try these steps to solve the issue : 1.- Recompile and restore table. Check fields with Table explorer; if table explorer doesn't show … Continua a leggere AX – D365FO – “Unretrieved” value in the table field

AX – D365FO – How to count affected/updated rows in a Update_recordset statement

How to know how many rows have been updated in a Update_recordset statement? It's simple, you can just use rowCount() method of the table after the update statement like shown below update_recordset inventTable setting ERACommercialGroupId = comunanzaERA.SubGroupId join comunanzaERA where inventTable.ItemId == comunanzaERA.comunanzaCode && comunanzaERA.SubGroupId != ''; info(strFmt("Copy Items from Comunanza ERA Subgroup Id to … Continua a leggere AX – D365FO – How to count affected/updated rows in a Update_recordset statement

AX – D365FO – Update a field value of a table with the value of a joined table in update_recordset

This example shows that the update_recordset statement supports the joining of several tables. Data from the joined tables can be used to assign values to fields in the table that is being updated. static void Join22aJob(Args _args) { TableEmployee tabEmpl; TableDepartment tabDept; TableProject tabProj; ; update_recordset tabEmpl setting currentStatusDescription = tabDept.DeptName + ", " + … Continua a leggere AX – D365FO – Update a field value of a table with the value of a joined table in update_recordset

AX – D365FO – X++ code to find all the Duties related to specific Privileges in AX 2012

static void findAllTheDutiesForSpecificPrivileges(Args _args) { SecurityTask securityTask; SecuritySubTask securitySubTask; #define.SecurityTask("AbbreviationCodeImport_Import_RU") // your privileges name select firstOnly RecId from securityTask where securityTask.AotName == #SecurityTask && securityTask.Type == SecurityTaskType::Privilege; while select SecurityTask from securitySubTask where securitySubTask.SecuritySubTask == securityTask.RecId { select firstOnly * from securityTask where securityTask.RecId == securitySubTask.SecurityTask; info(strFmt(“%1,%2,%3″, securityTask.AOTNAME, securityTask.Name, securityTask.Type)); } }

AX – D365FO – Cannot see newly created data source on a ListPage Form

When you come back to list page and try to restore the form you will not be able to see the new data source. To do this right click on the data source node and again define the name of the query. This will reload the new structure from the query. 4. Then you can view … Continua a leggere AX – D365FO – Cannot see newly created data source on a ListPage Form