I added a new customize fields (Location , Availability ) in Loan Item Form and set them mandatory , I need user can't leave this loan item if Location or Availability is empty .
So I added my validation in leave record method of loan item data source , but when I searched for specific loan item I got error of mandatory fields then I tried to add data on it but no thing happens fields doesn't accept data it still empty .
public boolean leaveRecord(boolean _ForUpdate)
{
boolean ret;
ret = next leaveRecord(_ForUpdate);
HcmLoanItem HcmLoanItem = this.cursor();
if (HcmLoanItem.AllocationType == 'Project' && !HcmLoanItem.Location)
ret = CheckFailed(/Location filed must be filled in /);
if (HcmLoanItem.AllocationType == 'Project' && !HcmLoanItem.Availability)
ret = CheckFailed(/Availability filed must be filled in /);
return ret;
}