Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

With this article you will create a page (Unplanned Function) that can make a simple registration optinally followed by a number of collector Steps.


Use cases

  • You want to register a single value in the Header
  • You want to register a single value in the Header and based on the value, a number of subsequent values as Steps


Overview

Table of Contents
maxLevel3
excludeDescription|Overview


Defining the page in Application.cfg

Step 1: Unplanned functions are called "Unplanned Item Registration"

Below is sample code for an Unplanned Item Registration called "MyItemReg".


Code Block
languagevb
titleAdd to application.cfg
<page id="MyItemReg" type="UnplannedItemRegistration" icon="mainmenuscaninfo">
  <title defaultValue="Titel"/>
  <unplannedItemRegistrationConfiguration type="MyItemReg" includeInputDataRowInSubmitRequest="true" useRegistrationCollector="true">
    <header configurationKey="MyItemReg" clearAfterPost="true" automaticAcceptOnOpen="true" automaticAcceptAfterLastScan="true"/>
    <onSuccessfulPost close="true" />
  </unplannedItemRegistrationConfiguration>
</page>


Note: For simplicity the Page id, Registration and Header -keys are all named "MyItemReg".

  • Page id unique page name
  • Registration key is how the back-end will identify the Unplanned Item Registration (including the Collector Steps)
  • Header key  is how the back-end will identify the Input fields shown on the top of the page. 

Note:

If you do not want to collect steps you must set useRegistrationCollector="false". And you can skip step 4.


Step 2: Add the main menu items

Code Block
languagevb
titleAdd to application.cfg
<!-- PAGES -->
<pages>
  <page id="MainMenu" type="Menu" icon="icon">
    <title defaultValue="Mobile WMS" />
    <menuConfiguration>
      <menuItems>          
		...
        <menuItem id="MyItemReg" displayName="MyItemReg" icon="mainmenuscaninfo" alwaysEnabled="true"/>


Handling the back-end

Step 3: Defining Header fields

This will define the field(s) displayed on the top of the page.

For simplicity we will only have a field called "ID".




This is defined in Codeunit "MOB WMS Reference Data"


Code Block
CreateConfig(XMLResponseData,'MyItemReg');



Code Block
'MyLookup','MyItemReg': MyLookupAndMyItemReg(XMLCDataSection);


Code Block
MyLookupAndMyItemReg(VAR XmlCDataSection : DotNet "System.Xml.XmlCDataSection")
// Used for Custom05UnplannedItemReg

AddConfHeaderTextValue(XmlCDataSection,
                       1,                 //id
                       'ID',              //name
                       'Enter ID:',       //label
                       100,               //label width
                       TRUE,              //clear on clear
                       TRUE,              //accept barcode
                       20,                //length
                       TRUE,              //optional
                       '',                //search type
                       '',                //eanAi
                       FALSE);            //locked


Step 4: Defining the "Steps" to

collect 

collect (optionel)

This is the code that will return the list of results and entries that you require.

When the header is accepted a new request is made for which Steps to collect, called  "GetRegistrationConfiguration".

In this step you must read the values header fields and define the subsequent steps.


This is defined in Codeunit "MOB WMS Adhoc Regstr."



Code Block
'MyItemReg':
    BEGIN
      MyItemReg(XMLRequestDoc);
    END;



Code Block
LOCAL MyItemReg(XMLRequestDoc : DotNet "System.Xml.XmlDocument")
// Extract any parameters from the XML
// The parameters are located in the <requestData> element
// The Unplanned Move feature expects 2 header values
// Location and Item
MobXMLMgt.GetDocRootNode(XMLRequestDoc, XMLRequestNode);
MobXMLMgt.FindNode(XMLRequestNode,MobWMSToolbox."CONST::requestData",XMLRequestDataNode);

// -- Now find the "ID"-attribute
MobXMLMgt.FindNode(XMLRequestDataNode,'ID',XMLParameterNode);

// Initialize the response xml
MobBaseToolbox.InitializeRespDocWithoutNS(XMLResultDoc,XMLResponseData);

// Add the <registrationCollectorConfiguration> element
MobXMLMgt.AddElement(XMLResponseData,'registrationCollectorConfiguration','',
                     MobXMLMgt.GetDocNSURI(XMLResultDoc),
                     XMLRegCollectorConfiguration);

// Add the <steps> element to the <registrationCollectorConfiguration>
MobXMLMgt.AddElement(XMLRegCollectorConfiguration,'steps','',MobXMLMgt.GetDocNSURI(XMLResultDoc),XMLSteps);

// Add the steps
MobConfTools.RC_Std_Parms(1,
                          'SomeText',
                          'Collecting some text',
                          '',
                          'Please enter some text');

MobConfTools.RC_Text_XmlNode(XMLSteps,
                             '',
                             20);



This will produce one collector step.

Asking for a text value.


Step 5: Handling the "posting" of Unplanned Item Registration

This code read the collected data and posts it.

If this code makes changes to the data the Lookup uses, you will see the result of the posting when the returning to the Lookup.


This is defined in Codeunit "MOB WMS Adhoc Regstr."


Code Block
'MyItemReg':
  BEGIN
    Status := PostMyItemReg(XMLRequestDoc);
    MobBaseToolbox.CreateSimpleResponse(XMLResultDoc,Status);
  END;

Create function "PostMyItemReg" by copying an existing posting function.

  • Modify the new function to read the "ID" and "SomeText" values.





Main menu with "MyItemReg" icon


The Unplanned Function with header and field