Description
The user wants to create two pages that can:
...
Step 2.1 Create header fields for both the lookup and the unplanned pages.
Use OnGetReferenceData_OnAddHeaderConfigurations OnAddHeaderConfigurations - The value that the user inputs will transfer to the Unplanned page, this is because both pages share the same Headerfield name, "ID"
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations', '', true, true)]
localprocedure My01OnGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record"MOB HeaderField Element")
begin
// MyItemReg
_HeaderFields.InitConfigurationKey('MyItemReg');
_HeaderFields.Create_TextField(1, 'ID', 'Enter ID
: '); _HeaderFields.Set_clearOnClear(true: ');
_HeaderFields.Set_optional(true);
// MyLookup
_HeaderFields.InitConfigurationKey('MyLookup');
_HeaderFields.Create_TextField(1, 'ID', 'Enter ID: ');
_HeaderFields.Set_
clearOnClear(true); _HeaderFields.Set_optional(true);
end;
- Step 2.2 Create a new Response Element for the Lookup
Use OnLookupOnCustomLookupType - For this example, three lines will be created and the value of the header field that the user input will be shown in the first line, as DisplayLine1
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Lookup", 'OnLookupOnCustomLookupType', '', true, true)]
localprocedure OnLookupOnCustomLookupType(_MessageId: Guid; _LookupType: Text; var _RequestValues: Record"MOB NS Request Element"; var _LookupResponseElement: Record"MOB NS WhseInquery Element"; var _RegistrationTypeTracking: Text; var _IsHandled: Boolean)
var
Counter: Integer;
begin
if _LookupType <>'MyLookup'then
exit;
// Create new Response Element
for Counter:=1to3dobegin
_LookupResponseElement.Create();
// Getting a value from the headerfields and showing it in Displayline1
_LookupResponseElement.SetValue('ID', _RequestValues.GetValue('ID'));
_LookupResponseElement.Set_DisplayLine1(_LookupResponseElement.GetValue('ID'));
_LookupResponseElement.Set_DisplayLine2(Format(Counter));
_LookupResponseElement.Set_DisplayLine3('Line 3');
_LookupResponseElement.Set_DisplayLine4('Line 4');
_IsHandled:=true;
end;
end;
- Step 2.3 Create the steps for the Unplanned page
Use OnGetRegistrationConfiguration_OnAddSteps - For this example, only two steps will be created, a TextStep and a DecimalStep - You can read more about steps here.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAddSteps', '', true, true)]
localprocedure MyOnGetRegistrationConfiguration_OnAddSteps(_RegistrationType: Text; var _HeaderFieldValues: Record"MOB NS Request Element"; var _Steps: Record"MOB Steps Element"; var _RegistrationTypeTracking: Text)
begin
if _RegistrationType ='MyItemReg'thenbegin
// STEP: Text step
_Steps.Create_TextStep(1, 'SomeText', 'Collecting some text');
// STEP: Decimal step
_Steps.Create_DecimalStep(2, 'DecimalStep'
); _Steps.Set_header('Decimal');
_Steps.Set_label(', 'Enter a number');
end;
end;
- Step 2.4 Handle the posting of the Unplanned registration
Use OnPostAdhocRegistrationOnCustomRegistrationType - In this step, the data is collected and posted. This can be further inspected in the Mobile Document queue list. You can read more about this here.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnCustomRegistrationType', '', true, true)]
localprocedure MyOnPostAdhocRegistrationOnCustomRegistrationType(_MessageId: Guid; _RegistrationType: Text; var _RequestValues: Record"MOB NS Request Element"; var _CurrentRegistrations: Record"MOB WMS Registration"; var _SuccessMessage: Text; var _RegistrationTypeTracking: Text; var _IsHandled: Boolean)
var
HeaderValue: Text;
DecimalValue: Decimal;
TextValue: Text;
begin
if _RegistrationType ='MyItemReg'thenbegin
if _IsHandled then
exit;
DecimalValue:=_RequestValues.GetValueAsDecimal('DecimalStep');
TextValue:=_RequestValues.GetValue('SomeText');
HeaderValue:=_RequestValues.GetValue('ID');
_SuccessMessage:=StrSubstNo('Value from the Decimal step is: %1, value from the Text step is: %2 and value from the Headerfield is: %3', DecimalValue, TextValue, HeaderValue);
_RegistrationTypeTracking:=StrSubstNo('%1 - %2 - %3', DecimalValue, TextValue, HeaderValue);
_IsHandled:=true;
end;
end;
How does it look on the device
...