Versions Compared

Key

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

Description

Excerpt

Create multilingual customizations using Mobile Messages.

Use cases

  • Modify existing translations
  • Support multiple languages with your customization

Behavior on the device

The field "Language Code" on Mobile Users, determines what Mobile Messages are used.

Mobile Messages can be modified by code as we will do in this example.

Step 1 - Adding mobile message

  • Adding a Mobile Message and its translation
  • The _LanguageCode corresponds to Mobile Language


    Description

    Excerpt

    Create multilingual customizations using Mobile Messages.


    Use cases

    • Modify existing translations
    • Support multiple languages with your customization

    Behavior on the device

    The field "Language Code" on Mobile Users, determines what Mobile Messages are used.

    Mobile Messages can also added by code as we will do in this example below.

    Editing Mobile Messages manually

    You can always manually from the Web Client, see Edit Mobile Messages.

    Edit Default Main Menu

    You can modify the existing Main menu, by creating specific mobile message that will overwrite the default.

    Image Added


    Expand
    titleList of Main Menu codes

    MainMenuReceive
    MainMenuPutAway
    MainMenuPick
    MainMenuCount
    MainMenuPhysInvtRecording
    MainMenuRegisterItemImage
    MainMenuUnplannedCount
    MainMenuProduction
    MainMenuAssembly
    MainMenuBulkMove
    MainMenuUnplannedMove
    MainMenuBinContent
    MainMenuLocateItem
    MainMenuPostShipment
    MainMenuSubstituteItems
    MainMenuItemCrossReference
    MainMenuAdjustQuantity
    MainMenuPrintLabel
    MainMenuPrintLabel
    MainMenuItemDimensions
    MainMenuToteShipping
    MainMenuPacking
    MainMenuLPContent
    MainMenuSettings
    LicensePlate_Update_Pos


    Editing Mobile Messages using code

    Step 1 - Adding mobile messages

    Using event OnAddMessages.

    • Adding a Mobile Message and translations for English and Danish
    • The _LanguageCode corresponds to Mobile Language

        [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Language", 'OnAddMessages', '', true, true)]
        localprocedureMyOnAddMessages(_LanguageCode: Code[10]; var_Messages: Record"MOB Message")
        begin
            if_LanguageCode='ENU'then
                _Messages.Create('ENU', 'MYSIGNATUREHELPLABEL', 'Make sure to verify the picked items.'); // Create English translation for my custom mobile message

            if_LanguageCode='DAN'then
                _Messages.Create('DAN', 'MYSIGNATUREHELPLABEL', 'Kontollér de plukkede varer.'); // Create Danish translation for my custom mobile message
        end;


    Step 2 - Using the mobile message as "label" for a header step on posting picks

    Using event OnPostPickOrder_OnAddStepsToAnyHeader.


    Step 2 - Using the mobile message as "label" on a step

        [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Pick", 'OnPostPickOrder_OnAddStepsToAnyHeader', '', true, true)]
        localprocedureMyOnPostPickOrder_OnAddStepsToAnyHeader(var_OrderValues: Record"MOB Common Element"; _RecRef: RecordRef; var_StepsElement: Record"MOB Steps Element")
        var
            MobWmsLanguage: Codeunit"MOB WMS Language";
        begin
            // Break if new step is already collected to prevent infinite loop
            if_OrderValues.HasValue('MySignatureStep') then
                exit;
            // Create a new Signature step
            _StepsElement.Create_SignatureStep(10000, 'MySignatureStep');
            _StepsElement.Set_helpLabel(MobWmsLanguage.GetMessage('MYSIGNATUREHELPLABEL')); // Set HelpLabel to use my custom mobile message
        end;
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Language", 'OnAddMessages', '', true, true)]    localprocedureMyOnAddMessages(_LanguageCode: Code[10]; var_Messages: Record"MOB Message")
        begin
            if_LanguageCode='ENU'then
                _Messages.Create('ENU', 'MYSIGNATUREHELPLABEL', 'Make sure to verify the picked items.'); // Create translation for my custom mobile message
        end;
    , Codeunit::"MOB WMS Pick", 'OnPostPickOrder_OnAddStepsToAnyHeader', '', true, true)]
        localprocedureMyOnPostPickOrder_OnAddStepsToAnyHeader(var_OrderValues: Record"MOB Common Element"; _RecRef: RecordRef; var_StepsElement: Record"MOB Steps Element")
        var
            MobWmsLanguage: Codeunit"MOB WMS Language";
        begin
            // Break if new step is already collected to prevent infinite loop
            if_OrderValues.HasValue('MySignatureStep') then
                exit;

            // Create a new Signature step
            _StepsElement.Create_SignatureStep(10000, 'MySignatureStep');
            _StepsElement.Set_helpLabel(MobWmsLanguage.GetMessage('MYSIGNATUREHELPLABEL')); // Set HelpLabel to use my custom mobile message
        end;

    Step 3 - Trigger "OnAddMessages"-event 

    With the above event subscribers active, go to Business Central

    1. Open the Mobile Language-page
    2. Select the language
    3. Select action "Mobile Message"
    4. Select action "Create Messages"
    5. Repeat step 1-4 for each language, in this case ENU and DAN


    Alternatively, you can write an Installation Codeunit that uses Codeunit "MOB WMS Language" to create the message in Step 1.



    See also

    Filter by label (Content by label)
    showLabelsfalse
    showSpacefalse
    sorttitle
    reversetrue
    excerptTypesimple
    cqllabel = "bc" and label = "onaddmessages"


    Before


    After

    English


    Image Added

    Danish