Hi,
I wrote code to do some validations when confirming the PO. So When I click /
confirmation/ button on the purch order form, the dialog appears and i click ok, I'm expecting some warnings to appear based on the code i added on the cofirmation action.
However, I noticed that not all warnings appear on the UI, why?? For example i was expecting 4 warnings to appear on the UI. However, only one appeared and the rest of the three appeared in the notification center. why they didn't all appear in the form?
[ExtensionOf(classStr(PurchFormLetter_PurchOrder))]
final class PurchFormLetter_PurchOrderX_Extension
{
private boolean must = false;
public boolean validate(Object _calledFrom)
{
boolean ret;
ret = next validate(_calledFrom);
if(ret)
{
PurchLine purchLine;
while select purchLine where purchLine.PurchId == this.PurchTable().PurchId
{
TableX tableX;
select firstonly tableX where tableX.ItemId == purchLine.ItemId;
if(tableX)
{
this.validateFirstField(purchLine, tableX);
this.validateSecondField(purchLine, tableX);
}
}
if(must)
{
throw error(/fix all errors/);
}
}
return ret;
}
public void validateFirstField(PurchLine _purchLine, TableX _tableX)
{
if(_tableX.FirstField == XType::Must && _purchLine.FirstField== '')
{
error(strFmt(/The FirstField for itemId: %1, is must be filled/, _purchLine.ItemId));
must = true;
}
else if(_tableX.FirstField == XType::Optional && _purchLine.FirstField== '')
{
warning(strFmt(/The FirstField for itemId: %1, is preferred be filled/, _purchLine.ItemId));
}
}
public void validateSecondField(PurchLine _purchLine, TableX _tableX)
{
if(_tableX.SecondField == XType::Must && _purchLine.SecondField == '')
{
error(strFmt(/The SecondField for itemId: %1, is must be filled/, _purchLine.ItemId));
must = true;
}
else if(_tableX.SecondField == XType::Optional && _purchLine.SecondField == '')
{//
warning(strFmt(/The SecondField for itemId: %1, is preferred be filled/, _purchLine.ItemId));
}
}
}
// i also tried to store all warnings in a variable and loop through them but same thing happened.