Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Description

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

Using event OnAddMessages.

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

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Language", 'OnAddMessages', '', true, true)]
    local procedure MyOnAddMessages(_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;



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

Using event OnPostPickOrder_OnAddStepsToAnyHeader.


    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Pick", 'OnPostPickOrder_OnAddStepsToAnyHeader', '', true, true)]
    local procedure MyOnPostPickOrder_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. Mobile Language
  2. Select the language
  3. Select "Create Messages"


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

See also


Before


After

  • No labels