Search This Blog

Monday 30 April 2018

Virtual Fields in Data Entity in Microsoft Dynamics 365 For Operations

Some times we need to populate fields on Data Entity based on some calculated X++ logic instead of binding them directly from table.

To do this below are the some simple steps.

1. right click your fields node of your data entity and than select the string Unmapped field.














note: you can select other type of umapped field if your field is not string.

2. After that go to the properties of that field set the name , label , extended data type and is computed field to no.

























After that right click your data entity and than override the postLoad() method.

and in that postload method you can write your X++ logic to populate that field.













Now after that once you rebuild your code and try to export data entity you will see this field will be populated in data entity.

Note: Data entities are saved as view on back end in sql and the main drawback of using virtual field is that you can see them in sql.You can only see when you use that entity with in Dynamics Domain.

Thanks,
Zahid


1 comment: