Skip to Content
0
May 12, 2020 at 09:08 AM

custom validation message doesn't show in expense report

85 Views Last edit May 13, 2020 at 12:00 AM 2 rev

Hi experts,

I have implemented some logic for one of the client in onSave validation to show some message if a condition met. The logic somehow works but it doesn't show the message:

the logic is as follow:

In the BO extension I have:

import AP.Common.GDT;
import AP.ExpenseReimbursementManagement.Global;
[Extension] businessobject AP.ExpenseReimbursementManagement.Global:ExpenseReport raises attachmentMessage, futurDateMessage {
      
message attachmentMessage text "No attachement found, Please attache documents to proceed";
message futurDateMessage text "You cannot select a future date";
   node Mileage {
       } 
   node Receipt {

      node ReceiptBeneficiary {
          } 
        }
}

In the validation I have:

import ABSL;
var flag = false;
var currentData = Context.GetCurrentSystemDate();
foreach(var r in this.Receipt)
{
if(r.Date.GreaterThan(currentData))
{
flag = true;
}
}
if(!this.AttachmentFolder.IsSet())
{
attachmentMessage.Create("E");
return false;
}
else if (flag)
{
futurDateMessage.Create("E");
}
else
{
return true;
}