Posts

Custom script/ Run Sql queries in 365/Visual studio with sql query

 str sql;             Connection conn;             SqlStatementExecutePermission permission;             ;             sql = "Update EntAssetWorkOrderTable set ModifiedBy = EntAssetWorkOrderTable.createdBy";             permission = new SqlStatementExecutePermission(sql);             conn = new Connection();             permission = new SqlStatementExecutePermission(sql);             permission.assert();             conn.createStatement().executeUpdate(sql);             CodeAccessPermission::revertAssert();

SQL script to get table name with with highest number of records

 SELECT      [TableName] = so.name,      [RowCount] = MAX(si.rows)  FROM      sysobjects so,      sysindexes si  WHERE      so.xtype = 'U'      AND      si.id = OBJECT_ID(so.name)  GROUP BY      so.name  ORDER BY      2 DESC

D365/Ax7 Data Entity error : Results. Field 'Invoice account' must be filled in. Results. validateWrite() failed on data source "Tablename"

Image
 Many times while importing data through Entity will get below error message : Results. Field 'Invoice account' must be filled in. Results. validateWrite() failed on data source "Tablename"                                              Root Cause : Allow edit and Allow Edit on create property is NO on table field level SO same property carry forwarded to Entity data source as well Solution :   both steps are necessary to resolve above error 1. Set "Allow edit" and "Allow Edit on create" property to Yes on Entity field level  2. Overide method mapEntityToDataSource() at Entity level and call skipDataSourceValidateField() with true as parameter as shown in below example      public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx,                     ...

D365/AX7 - Can not rename database - The database could not be exclusively locked to perform the operation

Image
 Some times after refreshing Devbox with VAL/PPD machine we need to rename new DB to AXDB but will get following error Solution : please make sure that following 3 services are stopped                     Still you are getting error message then run the following scripts to make single user          Set the database to single mode:      ALTER DATABASE dbName      SET SINGLE_USER WITH ROLLBACK IMMEDIATE      Try to rename the database: ALTER DATABASE dbName MODIFY NAME = NewName Set the database to Multiuser mode: ALTER DATABASE NewName SET MULTI_USER WITH ROLLBACK IMMEDIATE Start the services

Visual studio Dynamics D365/AX7 : Organize Elements/Synchronize data base on build for newly created Object

Image
 For D365 beginner developer it is difficult to find in visual studio elements will not be organized like form, Tables etc and whether database to be synchronized on project build Or not To achieve this following options need to checked in Visual Studio  Hope this is helpful!