Versions Compared


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



The most common control for customization

Add a new function to the Main menu. "Header fields" and optional "Steps" to collect

This example gives you

The unplanned workflow

Make sure the Unplanned Workflow fits your requirement.

Step 1: Defining a new Unplanned function 

This part requires you to edit the Mobile Configuration Files

Add this section in the <pages> tag.

Code Block
<!-- Custom -->
  <page id="MyUnplanned" type="UnplannedItemRegistration" icon="mainmenusettings">
    <title defaultValue="Titletext"/>
    <unplannedItemRegistrationConfiguration type="MyUnplanned" useRegistrationCollector="false">
      <header configurationKey="MyHeader" automaticAcceptOnOpen="true"/>
<!-- Custom -->

Add this section to the <menuItems> tag.

Code Block
<!-- Custom -->
<menuItem id="MyUnplanned" displayName="MyUnplanned" icon="mainmenusettings" alwaysEnabled="true"/>
<!-- Custom -->

Do you want this to be accesible from an existing page in the Action Menus

Then add this section to the <actions> tag.

Code Block
  <!-- Custom -->
  <open icon="mainmenusettings" id="MyUnplanned" title="My Unplanned">
    <returnTransfer property="UnplannedItemRegistrationCompleted" to="RefreshOnResume"/>
  <!-- Custom -->

Step 2: Define Header and header fields

Unplanned functions uses Header to determine which Steps to collect.

In this step you must define which header fields you want the user to see.

Subscribe to this event


    // Step 2: Define Header and headerFields

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations''', true, true)]
    local procedure MyGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
        _HeaderFields.InitConfigurationKey('MyHeader')// Identifier for new Header - replace by your own name

        // Add Header fields here
        _HeaderFields.Create_DateField(10'MyDate''Select date');

        _HeaderFields.Create_TextField(20'MyText''Enter text');

        _HeaderFields.Create_DecimalField(30'MyDecimal''Enter decimal');

Step 3: Return Steps to collect (Optional)

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.

If you want to collect steps you must set useRegistrationCollector="true" in Mobile Configuration Files.

Code Block
  <unplannedItemRegistrationConfiguration type="MyUnplanned" useRegistrationCollector="true"> 

You can use the already collected header fields values for:

  • defining the steps still needed to be collected
  • setting useful default-values on the steps 

Subscribe to this event


    // Step 3: Define Steps (optional)

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAddSteps''', true, true)]
    local procedure MyOnGetRegistrationConfiguration_OnAddSteps(_RegistrationType: Textvar _HeaderFieldValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
        MyDate: Date;
        MyText: Text;
        MyDecimal: Decimal;
        // Handle only your own Header name
        if _RegistrationType <> 'MyUnplanned' then

        // Read the headerFields
        MyDate := _HeaderFieldValues.GetValueAsDate('MyDate');
        MyText := _HeaderFieldValues.GetValue('MyText');
        MyDecimal := _HeaderFieldValues.GetValueAsDecimal('MyDecimal');

        // Add steps
        // For illustration, re-use the headerField value as default values on the steps



Step 4: Handle posting

When the Header has been accepted and Steps collected, a final request is made to "Post" the information ("PostAdhocRegistration")

In this step you must read the collected values and post them to the database.

Run your function fra Mobile and you can inspect the Post Request directly. See How-to: Use Mobile Document Queue to Inspect XML, View Request and Response XML and Error Call Stack and Debug

If you fail to perform Step 3, you will this error:

Code Block
titlePost Request
<?xml version="1.0" encoding="utf-8"?>
<request name="PostAdhocRegistration" created="2020-02-14T15:24:24+01:00" xmlns="">
  <requestData name="PostAdhocRegistration">

Subscribe to OnPostAdhocRegistrationOnCustomRegistrationType

  • Both Header values and Steps values are available.
  • The values are extracted from the _RequestValues parameter using "GetValue "functions.

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnCustomRegistrationType''', true, true)]
    local procedure MyOnPostAdhocRegistrationOnCustomRegistrationType(_RegistrationType: Textvar _RequestValues: Record "MOB NS Request Element"; var _CurrentRegistrations: Record "MOB WMS Registration"; var _SuccessMessage: Textvar _RegistrationTypeTracking: Textvar _IsHandled: Boolean)
        MyDate: Date;
        MyText: Text;
        MyDecimal: Decimal;
        if _RegistrationType <> 'MyUnplanned' then

        if _IsHandled then

        // Read _RequestValues
        MyDate := _RequestValues.GetValueAsDate('MyDateStep');
        MyText := _RequestValues.GetValue('MyTextStep');
        MyDecimal := _RequestValues.GetValueAsDecimal('MyDecimalStep');

        _SuccessMessage := StrSubstNo('Success %1 %2 %3', MyDate, MyText, MyDecimal);
        _RegistrationTypeTracking := 'Tracking info for the Document queue.';

        _IsHandled := true;

For illustration, the steps-values are used in the success-message

Step 5: Set tracking info (optional)

The parameter _RegistrationTypeTracking can be used to make the Document Queue display additional information about your process.

Common error messages

"No document handler is available for GetRegistrationConfiguration::XYZ"

Error occurs when Accepting the header.


No steps are returned.

See Step 3.

"No document handler is available for GetRegistrationConfiguration:XXX/XmlSteps"


No steps are returned.

See Step 3.

"No document handler is available for PostAdhocRegistrationConfiguration::XYZ"

Error occurs when posting.


Posting is not handled.

See step 4

Content by Label
titleMore examples
cqllabel = "bc" and label = "example" and label = "unplanned"

Icon in Main menu

"MyUnplanned" is shown on the main main.

Unplanned function Header

Header fields

Unplanned function Steps

First step

Second step.

3rd and final step.


Posting completed.
Message is displayed.