Versions Compared

Key

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


Introduction

This article describes how to add a new custom action to a "BurgerMenu" at existing pages.

...

... the "Send to Robot"-option will open a new "Send To Robot"-page, including a "SUBMIT" that will trigger our mocked code in the backend.


Overview

The steps to create a new menu action are (discussed in details below):

  1. New Configuration Header for "Send To Robot"-page
  2. Associate configuration header with new page in application.cfg
  3. Add action to existing "BurgerMenu"
  4. Handle new RegistrationType in codeunit "MOB WMS Adhoc Registr.
  5. Testing the solution


Example

Step 1: New Configuration Header for "Send To Robot"-page

To be able to submit a request to the backend, a page must exist including visible fields that holds the information needed by the backend. The SUBMIT request will include the visible fields and its values.

...

The code above will add a new entry to Reference Data, identified by new Key "SendToPickRobotHeader".


Step 2: Associate configuration header with new page in application.cfg

Next, our new configuration header "SendToPickRobotHeader" needs to be associated with a new page in application.cfg. 

...

Code Block
titleapplication.cfg
<page id="SendToPickRobot" type="UnplannedItemRegistration" icon="">
	<title defaultValue="Send To Robot"/>
	<unplannedItemRegistrationConfiguration type="SendToPickRobotRegistrationType" useRegistrationCollector="false">
		<header configurationKey="SendToPickRobotHeader" automaticAcceptAfterLastScan="true"/>
	</unplannedItemRegistrationConfiguration>
</page>


Step 3: Add action to existing "BurgerMenu"

The new "Send To Robot" action is added to the existing PickLines-page in application.cfg – this will associate the action to the new page we created above. The entire page is shown below, but only this line is new:

...

Code Block
titleapplication.cfg
   <page id="PickLines" type="OrderLines" icon="mainmenupick">
      <title defaultValue="@{PagePickOrderLinesTitle}"/>
      <orderLinesConfiguration>
        <service id="Pick"/>
        <list listId="OrderLinesWithImages"/>
        <viewRegistrations title="@{OrderLinesRegistrationMenuItem}" navigateTo="ViewRegistrations" enabled="true"/>
        <deleteOrderRegistrations title="@{OrderLinesDeleteAllOrderRegistrationsMenuItem}" enabled="true"/>
        <totePicking allowManualSelection="true">
          <currentTote show="true" useLabelPrefix="false"/>
        </totePicking>
        <scanToSelectBehaviour gs1SearchTerm="Item" behaviour="Auto"/>
      </orderLinesConfiguration>
      <actions>
        <showImage id="1" enabled="true" imageProperty="ItemImage" title="@{MenuItemShowImageTitle}"/>
		<open id="SendToPickRobot" icon="" title="Send To Robot" />
      </actions>
    </page>   


Step 4: Handle new RegistrationType in codeunit "MOB WMS Adhoc Registr."

As per our "Send To Robot"-page defnition the submit button will submit a DocumentType='PostAdhocRegistration', RegistrationType='SendToPickRobotRegistrationType' request.

...

Code Block
titlecodeunit 6181380 "MOB WMS Adhoc Registr."
    // >> SendToPickRobot
    local procedure SendToPickRobot(XMLRequestDoc: XmlDocument; var ReturnRegistrationTypeTracking: Text[200]): Text[60];
    var
        MobXmlMgt: Codeunit "MOB XML Management";
        OrderBackendID: Code[23];
        LineNumber: Integer;
    begin
        // Disable the locktimeout to prevent timeout messages on the mobile device
        LOCKTIMEOUT(false);

        MobDocQueue.LoadXMLRequestDoc(XMLRequestDoc);
        OrderBackendID := MobXmlMgt.XPathInnerText(XMLRequestDoc, '//req:OrderBackendID');
        Evaluate(LineNumber, MobXmlMgt.XPathInnerText(XMLRequestDoc, '//req:LineNumber'));

        // Mock something that can be recognized at the mobile device for this example
        ReturnRegistrationTypeTracking := StrSubstNo('MOCK Fetch OrderBackendID %1, LineNumber %2', OrderBackendID, LineNumber);
        exit('MOCK PickRobot instructions was issued');
    end;
    // << SendToPickRobot


Step 5: Testing the solution

Submitting from the "Send To Robot" page should now display the message we returned from our custom "SendToPickRobot()"-method:

...