Book Image

Dynamics 365 for Finance and Operations Development Cookbook - Fourth Edition

By : Abhimanyu Singh, Deepak Agarwal
Book Image

Dynamics 365 for Finance and Operations Development Cookbook - Fourth Edition

By: Abhimanyu Singh, Deepak Agarwal

Overview of this book

Microsoft Dynamics 365 for Finance and Operations has a lot to offer developers. It allows them to customize and tailor their implementations to meet their organization’s needs. This Development Cookbook will help you manage your company or customer ERP information and operations efficiently. We start off by exploring the concept of data manipulation in Dynamics 365 for Operations. This will also help you build scripts to assist data migration, and show you how to organize data in forms. You will learn how to create custom lookups using Application Object Tree forms and generate them dynamically. We will also show you how you can enhance your application by using advanced form controls, and integrate your system with other external systems. We will help you script and enhance your user interface using UI elements. This book will help you look at application development from a business process perspective, and develop enhanced ERP solutions by learning and implementing the best practices and techniques.
Table of Contents (18 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface

Using the date effectiveness feature


Date effectiveness allows developers to easily create date range fields. Date ranges are used to define record validity between the specified dates, for example, defining employee contract dates and defining vendor license validity.

This feature significantly reduces the amount of time that developers spend on developing business logic/code and also provides a consistent approach to implement data range fields.

This recipe will demonstrate the basics of date effectiveness. We will create a new table to implement date range validation.

How to do it...

Carry out the following steps in order to complete this recipe:

Run Visual Studio as admin:

  1. Load your earlier project.
  2. Add a new TablePktEmployeeContract.

Set the property as follows:

Property

Value

ValidTimeStateFieldType

Date

Note the two new fields that are automatically added to the table, as shown in the following screenshot (ValidTo and ValidFrom):

  1. Now create a new index as follows and add fields as follows:
  1. Set the following mentioned property for the index here:

Property

Value

AlternateKey

Yes

ValidTimeStateKey

Yes

ValidTimeStateMode

NoGap

  1. Now open the table and enter some records in this table itself instead of creating a new form for the table. Right-click on Table and select Browse table:

How it works...

We start the recipe by setting the ValidTimeStateFieldType property to Date in the SysEmailTable table. This automatically creates two new fields--ValidFrom and ValidTo that are used to define a date range.

Next, we add the created fields to the primary index where the EmplNum field is used and adjust the index's properties.

We set the AlternateKey property to Yes in order to ensure that this index is a part of an alternate key.

We set the ValidTimeStateKey property to Yes in order to specify that the index is used to determine valid date ranges.

We also set the ValidTimeStateMode property to NoGap in order to ensure that email templates with the same identification number can be created within continuous periods. This property can also be set to Gap, allowing noncontiguous date ranges.