D365 SCM. Extension of promoted fields feature in the Warehouse Management mobile app

Extension of promoted fields feature in the Warehouse Management mobile app

Microsoft has recently introduced a promoted fields feature. It allows to promote and to highlight a specific information of each and any step in the task flows of the Warehouse Management mobile app. The setups are described here and a walkthrough demonstration is hereLet’s take a look at this feature from a technical perspective.

Overview

The key object is the WHSMobileAppFlow class. It is an abstract class that has a number of methods. We will take a look at the most important ones:

initValues              - it is an abstract method. It must be overridden when a new WHSMobileAppFlow derived class is created.

getAvailableFieldsit is used for default data created when the Create default setup button is hit on the Mobile device steps form.

addAvailableField - it is used for defining fields that should be available for promotion.

All other methods of  WHSMobileAppFlow class are either called up by the above-mentioned methods or they are internal and cannot be used in the code.

Promoted fields feature for new mobile device flows

For every mobile device flow, there is a derived class from the WHSMobileAppFlow object.
For example for the “UserDirected” flow:

[WHSWorkExecuteMode(WHSWorkExecuteMode::UserDirected)]
final class WHSMobileAppFlowUserDirected extends WHSMobileAppFlow
{
    protected void initValues()
    {
        this.addStep(WHSMobileAppStepIds::WorkId);
        this.addStep(WHSMobileAppStepIds::WHSWorkLicensePlateId);
        this.addWorkExecutionSteps();
 
        this.addWorkExecutionFields();
    }
}

So if we need to add the promoted fields feature for the custom developed WHS mobile app flow, we do the same – a new derived class from the WHSMobileAppFlow object.

[WHSWorkExecuteMode(WHSWorkExecuteMode::NewWorkExecuteMode)]
final class WHSMobileAppFlowNewWorkExecuteFlow extends WHSMobileAppFlow
{
    protected void initValues()
    {
        //adding necessary fields
        this.addAvailableField(extendedTypeNum(ItemId));
        this.addAvailableField(extendedTypeNum(Qty));
    }
}

After compilation and recreating the setups via the Create default setup button on the Mobile device steps form, the added fields should be available for the promoted fields feature:


Note: Please keep in mind, the addStep method cannot be used with WHSMobileAppStepIds::EnumValue since the WHSMobileAppStepIds class is marked as internal (10.0.24). Probably it can be changed in the future versions.

Promoted fields feature for new mobile device fields

Let's imagine there is a new field that we would like to use with this feature. For example, a new inventory dimension was added as described here.
In this case, we needed to add a new extension for the WHSMobileAppFlowUserDirected class, for instance:

[ExtensionOf(classStr(WHSMobileAppFlowUserDirected))]

final class WHSMobileAppFlowUserDirected_Extension
{
    protected void initValues()
    {
        next initValues();

        this.addAvailableField(extendedTypeNum(InventDimension1));

    }
}

After compilation and recreating the setups via the Create default setup button on the Mobile device steps form the added field should be available for the promoted fields feature:

Important:  For the mentioned extended data types (ItemId, InventDimension1) derived classes from the WHSField class should be developed as described here. Otherwise, it can be not really possible to add new fields.



No comments:

How to run batch tasks using the SysOperation framework

Overview As you may know, the system has batch tasks functionality . It can be used to create a chain of operations if you want to set an or...