OnGetProductSourceParams

This event can be used to decide the production location, supplier and stock location for the item line

Example and syntax

//Helper function
function HasAluCladding(aWrapper:TSalesLineWrapper): boolean;
var
  vItem:TVariantItemWrapper;
begin
  vItem := aWrapper.Variants.GetMainItem(CladdingVar,LevOne);
  Result := (vItem <> Nil) and (vItem.Selcode = 'ALU');
end;


procedure OnGetProductSourceParams(aSalesline:TSalesLineWrapper; const aParams:TScriptOnGetProductSourceParams);
begin
  if (aSalesline.Code = 'PT A') and HasAluCladding(aSalesline) then
  begin
    aParams.ProductionLocationId := 'LOC B'; 
    aParams.SupplierId := '';
  end;
end;

Last updated

Was this helpful?