Hi. everyone.
i have a some issue.
The validation logic of the standard table and class must be skipped. I would like to ask if this is technically possible.
I know how to set the Ret value to true with COC method.
However, what should I do if there is a "throw error" in the middle of the standard source code as shown below?
Even if i put "next" in front or behind, it will eventually fall into an error at that part.
i want to skip below code.
if (conFind(con, VendTable::find(purchReqLine.VendAccount).RecId) == 0)
{
throw error("@SYS300295");
}
PurchReqLineValidate (Class)
--------------------------
public boolean validateVendor()
{
ProcCategoryPolicyParameter procCategoryPolicyParameter;
List listVendors = new List(Types::Record);
boolean isCategoryAvailable = false;
boolean isValidItem = false;
boolean isVendorFound = false;
VendCategoryStatus vendCategoryStatus = -1;
boolean isApprovedOrStandard = false;
container con;
if (purchReqLine.isVendorBlocked())
{
return false;
}
// catalog Item
if ( purchReqLine.LineType == PurchReqLineType::Item )
{
isVendorFound = true;
if (this.validateInventItem())
{
if (purchReqLine.RequisitionStatus == PurchReqRequisitionStatus::Draft && purchReqLine.VendAccount)
{
con = PurchReqLine::findVendors(purchReqLine);
if (conFind(con, VendTable::find(purchReqLine.VendAccount).RecId) == 0)
{
throw error("@SYS300295");
}
}
}
else
{
throw error("@SYS306981");
}
}
else //Non-catalog item
{
isCategoryAvailable = this.checkCategoryAvailability();
if (!isCategoryAvailable)
{
return true;
}
// For approved purchase requisitions, it should be allowed to edit the vendor and the policy does not apply.
if (purchReqLine.RequisitionStatus == PurchReqRequisitionStatus::Approved)
{
return true;
}
procCategoryPolicyParameter = purchReqLine.procCategoryPolicyParameter();
if (procCategoryPolicyParameter.RecId != 0 )
{
// The reviewer selects the vendor during the review process if policy rule is 'Do not allow vendor selection in this category'.
if (purchReqLine.RequisitionStatus == PurchReqRequisitionStatus::InReview && procCategoryPolicyParameter.VendorSelection == ProcCategoryVendorSelection::SelectionNotAllowed)
{
return true;
}
isVendorFound = PurchReqVendorPolicyValidation::validateCategoryPolicyForVendor(procCategoryPolicyParameter.VendorSelection, purchReqLine.VendAccount, purchReqLine.ProcurementCategory,
purchReqLine.RequiredDate, purchReqLine.BuyingLegalEntity);
}
else
{
isVendorFound = true;
}
if (!isVendorFound)
{
return checkFailed("@SYS345136");
}
}
return isVendorFound;
}