Technical Episode 3
Technical Episode 3
CUSTOMIZATION
EPISODE 3
➢ CREATING MAIN DATA TABLE
CREATING A D365 PROJECT AND SOLUTION
• Open Visual Studio
• Open project
TABLE STRUCTURE
• 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);
return vehicleTable;
}
ADD EXIST METHOD
public static boolean Exist(ConVMSVehicleId _vehicleId)
ConVMSVehicleTable vehicleTable;
if (_vehicleId != '')
from vehicleTable
}
OVERRIDE VALIDATEFIELD METHOD
public boolean validateField(FieldId AcquiredDate)
boolean ret;
ret = super(AcquiredDate);
switch (AcquiredDate)
ret = checkFailed("@ConVMS:AcqDateMustBeTodayOrLater"); }
Create a label for the error message returned by checkFailed and replace the literal with the label ID.