OnLookupOnPrintReport_OnAfterAddStepForReport

Use this event to

Modify existing step properties for a request page handler


See also: 

OnLookupOnPrintReport_OnAddStepsForReport

Description

This event is executed once for every step added by either standard or custom request page handlers.

You may use this event to change any property of the step or hide the step.

Template

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Report Print Lookup", 'OnLookupOnPrintReport_OnAfterAddStepForReport', '', true, true)]
    local procedure MyOnLookupOnPrintReport_OnAfterAddStepForReport(_MobReport: Record "MOB Report"; var _RequestValues: Record "MOB NS Request Element"; _SourceRecRef: RecordRef; var _Step: Record "MOB Steps Element");
    begin
    end;
 Click here for parameters...
  • _MobReport 
    • The mobile report to handle. The record can i.e. be used to see the report number and which request page handler the mobile report is to be handled by.
  • _RequestValues
    • The request values with header values and context values. 
  • _SourceRecRef: 
    • A RecordRef to the context the print is called from, if available. 
    • I.e. Sales Order Line, Warehouse Receipt Line, Purchase Order Return Line, Warehouse Activity(Pick, Put-away) etc.
  • _Step:
    • The step you want to modify. 


Example

    // [Example] Change an existing step : Double to the default value of the No of Copies step to apply a label to two sides of each box
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Report Print Lookup", 'OnLookupOnPrintReport_OnAfterAddStepForReport', '', true, true)]
    local procedure My01OnLookupOnPrintReport_OnAfterAddStepForReport(_MobReport: Record "MOB Report"; var _RequestValues: Record "MOB NS Request Element"; _SourceRecRef: RecordRef; var _Step: Record "MOB Steps Element");
    var
        OriginalNoOfCopies: Integer;
    begin
        // Making sure we only modify the Item Label steps
        if (_MobReport."RequestPage Handler" <> _MobReport."RequestPage Handler"::"Item Label") then
            exit;

        // Double the default value of the NoOfCopies step to apply a label to two sides of the box
        if _Step.Get_name() = 'NoOfCopies' then
            if evaluate(OriginalNoOfCopies, _Step.Get_defaultValue()) then
                _Step.Set_defaultValue(OriginalNoOfCopies * 2);
    end;

More examples


Version History

VersionChanges
MOB5.46Introduced