December 21, 2018

How to set default fields to be available while using Excel add-ins

Hi Folks,
As we know D365FO comes with a powerful architecture for all integration using DIXF. Data entities are the only way (in most of the cases) to communicate with D365FO through an external system.
In today’s post, I’m going to share a quick tip on how to set default fields to be made available while using Excel add-ins for CRUD operation. Yes, now you can use excel add-ins to perform all CRUD operation on a user interface. Let's take the example of customer master.
Below screenshot shows how to access excel add-ins on customer master. Go to Customer master and on right-hand side upper corner, you may found Office icon. Click on it and select
image

It will show you all the data entities which are available in the system based on customer (CustTable) as the main data source. Select the first one,
image

and it will open an excel sheet with Dynamics Add-ins. You might need to sign in using a valid user which have access to D365Fo application. Excel must look like below with a Dynamics add-ins in left.

image

You can perform all CRUD operation here and hit publish button on the left down side to publish your changes to the server. That’s it.
Now coming to the title of this post, (it's not too late Winking smile ) if you want to make any changes on these fields, like remove and add new or want to change the order, here is the trick.
Go to visual studio, open the data entity (in this case you need to create an extension of this entity). Go to field group > AutoReport. Here you must get all field which is showing on excel. You can do addition, delete, change the order of fields and that’s it. Once successful build changes will reflect when you use excel add-ins next time.

Cheers,
Harry

December 13, 2018

[Solved]Error while code check-in in visual studio ‘Could not find file….’


Hi Folks,
Here is a quick trick. I was trying to check-in a few objects in a solution and encounter a strange error.

Error:
Could not find file 'C:\Users\Adminbefabcsd4\Documents\Visual Studio 2015\Projects\<MySolution>\<MyProject>\<MySolution>.btproj

Possible reason: If you are trying to check-in your object along with the solution file, you might get this error.

Possible solution: I cannot say it a permanent fix as I didn't find any technical reason for this, but below fix worked for me.
If you didn't make any changes in the solution itself, like adding/deleting a file, you should not include solution file in included changes. Remove solution file and check-in only object which you actually made changes.

Cheers!!!
Harry

December 11, 2018

Create delivery address run time

Folk,

Here is quick code to create the delivery address on runtime. You can use this on Purchase Requisition, Purchase order or a person.
So we are going to use LogisticsPostalAddressEntity to get the right address with a new one or an existing one. This code should also handle if there is any update in any existing record by updating effective date stamp.

Have a look on below code,



Give a try and share your feedback.

Cheers!!!
Harry.

November 15, 2018

[Solved]D365 FO data entity Synch error

[Updated on: Feb 26, 2020]

Hi Folks,

This quick post about one of the error while working on Data entities,

Error message: Severity Code Description Project File Line Suppression State Error ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'I_65518FIELD'. Cannot insert duplicate key in object 'dbo.SQLDICTIONARY'. The duplicate key value is (<tableId>, <FieldId>, 1, 0). 0


Other error messages: 
Severity
Code
Description
Error
(20594,13,1,'SupplierContractId','SUPPLIERCONTRACTID',0,20,0,0,0,0);
Error
at Microsoft.Dynamics.AX.Framework.Database.Tools.SyncEngine.RunSync(SyncOptions options)
Error
at Microsoft.Dynamics.AX.Framework.Database.Tools.SyncEngine.PartialSync()
Error
at Microsoft.Dynamics.AX.Data.Management.ManagedSyncTableWorker.ExecuteModifyTableViaAlterTable(AxTable newTableSchema, IndexListCache ignoreIndexListCache, IncrementalSyncTableSchemaBuilder tableSchemaBuilder)
Error
Database execution failed: Violation of PRIMARY KEY constraint 'I_65518FIELD'. Cannot insert duplicate key in object 'dbo.SQLDICTIONARY'. The duplicate key value is (20594, 4, 1, 0).
Error
at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.SqlCommandExtensions.<>c__DisplayClass1.<ExecuteNonQueryWithRetry>b__0()
Error
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
Error
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.RunPartialTableSync(SyncOptions options, String sqlConnectionString, IMetadataProvider metadataProvider)
Error
at Microsoft.Dynamics.AX.Data.Management.DBExecute.ThrowOnSqlExecuteException(SqlException e, String commandText)
Error
at Microsoft.Dynamics.AX.Data.Sql.SqlDataAccessManager.HandleException(ExceptionDispatchInfo edi, SqlExecutionInfo execInfo)
Error
Inner exceptions:
Error
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
Error
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.ExecuteWithinAOS(SyncOptions syncOptions, String sqlConnectionString, IMetadataProvider metadataProvider, Func`1 func, Action`1 errorHandler)
Error
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

Possible solution: Delete all fields from the staging table and regenerate the same through right-clicking on data entity, refer below.

image

Another thing you should try is, to delete any data import/export project which you may have created while testing. 

Now rebuild your solution and try.

Cheers!!!
Harry