This blog will explain how you, with only a few modifications, can extend the load posting code to include your own business logic.
An example where an event notification is triggered as part of the load posting will be used to illustrate how an extension can be done.
Load posting from the UI
You can release a load to the warehouse from the load planning workbench by clicking the Release button and selecting Release to warehouse.
The following illustration shows how to do this.
Figure 1: The load planning workbench
Several load posting methods are allready provided in Warehouse management and these will be called when the load is released to warehouse.
You can view these methods on the Load posting methods form by clicking Warehouse management > Setup > Load posting methods.
These methods are implemented in the WHSLoadPostEngineBase class, and are called when a load is released.
The following illustration shows the Load posting methods form, and the next section describes how to add your own methods to the list.
Figure 2: Load posting methods
Extending the load posting methods
The system is designed to be extensible so that you can add and execute your own business logic when a load is released to warehouse.
Note : In the application code the release of a load to the warehouse is called load posting.
You can extend the load posting functionality by following a few simple steps.
1. You add a new method with your business logic to the class called WHSLoadPostEngineCustom.
The method must have the signature as the example below, meaning it must accept a Boolean parameter. The example creates an alert notification informing the user that the load has been released.
public boolean sendAlertWhenLoadIsPosted(boolean _validate = false)
EventNotification event = EventNotification::construct(EventNotificationSource::Sync);
event.parmUserId(curuserid()); //this is the user that will receive the alert.
event.parmMenuFunction(new MenuFunction(menuitemDisplayStr(WHSLoadPlanningWorkbench), MenuItemType::Display)); //this will link to the customer form
event.parmSubject('Load is being released to the warehouse');
event.parmMessage(strFmt('Hi, load %1 us being released - get to work', loadTable.LoadId)); event.create();
2. On the load posting methods form, click the Add new methods button. This will find new methods that are added to the load posting classes. The Regenerate methods button will first delete all added methods and then add all method.
Once the operation completes the form should show your new method. You can move the method up or down to control the sequence of the method calls.
If you release the load to the warehouse you should see that a notification is added, as shown in the following illustration.
Figure 3: The notification that was created from the extension to the load posting
And that’s it, you have now extended the load posting functionality!