OnGetProductSourceAltParams

This event can be used to filter legal production locations or suppliers for an item line. Legal values must be defined for each product (defined in tables). The script can only remove illegal values.

Example and syntax

procedure OnGetProductSourceAltParams(aSalesline:TSalesLineWrapper; const aParams:TScriptOnGetProductSourceAltParams);
var
  vMaterialOption : TVariantItemWrapper; 
begin
  if (aSalesline.Code='PT A') then 
  begin
    vMaterialOption := aSalesline.Variants.GetMainItem(MaterialVar, levOne); 
    if assigned(vMaterialOption) and (vMaterialOption.SelCode = 'OAK') then
      aParams.RemoveProductionLocation('LOC B'); //cannot produce this product in oak
  end;
  
  if (aSalesline.Code='PT B') then 
  begin      
    if aSalesline.HasCornerCuts then
      aParams.RemoveSupplier('A1001'); //Cannot produce this product with cornercuts
  end;
end;

Last updated

Was this helpful?