0% found this document useful (0 votes)
7 views17 pages

Technical Episode 3

Uploaded by

nafepe5243
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views17 pages

Technical Episode 3

Uploaded by

nafepe5243
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

TECHNICAL

CUSTOMIZATION
EPISODE 3
➢ CREATING MAIN DATA TABLE
CREATING A D365 PROJECT AND SOLUTION
• Open Visual Studio
• Open project
TABLE STRUCTURE

Field Type Size EDT (: indicates extends)


VehicleId String 20 *ConVMSVehicleId : Num
VehicleGroupId String 10 ConVMSVehicleGroupId
RegNum String 10 * ConVMSRegNum
AcquiredDate Date *ConVMSAcquiredDate : TransDate
CREATE NEW EDTS
• Create the ConVMSVehRegNum string EDT with the following properties
• Property Value
• Name ConVMSVehRegNum
• Size 10
• Label Registration—add a comment that this is a vehicle registration number
• Help Text The vehicle registration number
CREATE NEW EDTS
• Create a date EDT named ConVMSAcquiredDate with the following properties
• Property Value
• Name ConVMSAcquiredDate
• Extends TransDate
• Label Date acquired
• Help Text The date that the vehicle was acquired
CREATE NEW TABLE
• Create a new table and name it ConVMSVehicleTable
• . Drag the following EDTs on to the Fields node in this order:
• ConVMSVehicleId
• Name
• ConVMSVehicleGroupId
• ConVMSVehicleType
• ConVMSVehRegNum
• ConVMSAcquiredDate
✓ Remove the ConVMS prefix
✓ On the VehRegNum field, change the AliasFor property to VehicleId
CREATE NEW TABLE
• Change the VehicleId field properties as an ID field like so:
• Property Value
• AllowEdit No
• AllowEditOnCreate Yes
• Mandatory Yes
• These properties only affect the way the field behaves on a form.

• Make the VehicleGroupId field mandatory.


ADD INDEX
• Create a unique index called VehicleIdx with the VehicleId field.
• Create an index called VehicleGroupIdx and add the VehicleGroupId field to it
ADD FIELD GROUPS
• Create a unique index called VehicleIdx with the VehicleId field.
ADD TABLE PROPERTIES
• Property Value
• Label VehicleTable
• Title Field 1 VehicleId
• Title Field 2 Name
• Cache lookup Found
• Clustered Index VehicleIdx
• Primary Index VehicleIdx
• Table Group Main
• Created By Created Date Time Modified By Modified Date Time = Yes
• Developer documentation = ConVMSVehicleTable contains vehicle records
• Form Ref Leave this blank until we have created the form.
ADD FIELD GROUP
• Create a field group named Overview
• Label = @SYS9039
• Drag in the fields -> VehicleId, Name, VehicleGroup, and VehicleType
• Create a field group, Details, and find an appropriate label.
• Drag in the fields that should show on the header of the form when viewing the details of
the vehicle. This should repeat the information from the overview group, as these field
groups are not visible to the user at the same point;
• Overview is for the list of records, and Details is placed at the top of the details form,
where the user would want to review the full details of a vehicle.
ADD FIELDS IN AUTOLOOKUP
• Add VehicleId is added first.
ADD RELATION
• Create a foreign key relation for the VehicleGroupId field using the following
properties:
• Parameter Value
✓ Name ConVMSVehicleGroup
✓ Related Table ConVMSVehicleGroup
✓ Cardinality OneMore: The field is mandatory
✓ Related Table Cardinality ZeroOne
✓ Relationship Type Association
✓ On Delete Restricted

• Add a normal field relation to the relation, connecting the VehicleGroupId fields
OVERRIDE METHODS
• Right-click on the Methods node and select Override | initValue.
• Code:
public void initValue()
{
super();
ConVMSParameters parm = ConVMSParameters::Find();
this.VehicleGroupId = parm.DefaultVehicleGroupId;
}
ADD FIND METHOD
public static ConVMSVehicleTable Find(ConVMSVehicleId _vehicleId, boolean _forUpdate = false)

ConVMSVehicleTable vehicleTable;

if (_vehicleId != '')

vehicleTable.selectForUpdate(_forUpdate);

select firstonly * from vehicleTable

where vehicleTable.VehicleId == _vehicleId;

return vehicleTable;

}
ADD EXIST METHOD
public static boolean Exist(ConVMSVehicleId _vehicleId)

ConVMSVehicleTable vehicleTable;

if (_vehicleId != '')

select firstonly RecId

from vehicleTable

where vehicleTable.VehicleId == _vehicleId;

return (vehicleTable.RecId != 0);

}
OVERRIDE VALIDATEFIELD METHOD
public boolean validateField(FieldId AcquiredDate)

boolean ret;

ret = super(AcquiredDate);

switch (AcquiredDate)

case fieldNum(ConVMSVehicleTable, AcquiredDate):Timezone clientTimeZone = DateTimeUtil::getClientMachineTimeZone();

TransDate today = DateTimeUtil::getSystemDate(clientTimeZone);

if(this.AcquiredDate < today)

{/// The acquisition date must be today or later

ret = checkFailed("@ConVMS:AcqDateMustBeTodayOrLater"); }

break; } return ret;}

Create a label for the error message returned by checkFailed and replace the literal with the label ID.

You might also like