FormDataSourceEventType::ValidatingWrite in d365
/// <summary>
/// When saving a new rental, prevent setting the start mileage on the FMRental
/// </summary>
[FormDataSourceEventHandler(formDataSourceStr(FMRental, FMRental), FormDataSourceEventType::ValidatingWrite)]
public static void FMRental_OnValidatingWrite(FormDataSource sender, FormDataSourceEventArgs e)
{
var datasource = sender as FormDataSource;
var args = e as FormDataSourceCancelEventArgs;
if (args != null && datasource != null)
{
FMRental record = datasource.cursor() as FMRental;
if (record.recId == 0)
{
if(record.startmileage == 1)
{
boolean doCancel = !checkFailed("Start Mileage = 1 is not allowed");
args.cancel(doCancel);
}
}
}
}
thanks,
Vikas Mehta.
No comments:
Post a Comment