In some cases, users of Warehouse Insight will want to be able to take pictures and add that picture to the document from their mobile devices. This article will walk through the steps and code required to add capture a picture on a Sales Order from the device and add it as an attachment to the document.
This article requires the following:
- Business Central version 15 or higher
- Warehouse Insight Advanced WMS version 2.0 or higher
The following steps/code can be modified or extended as required and assume a base level familiarity with Business Central and Warehouse Insight.
1. Add a Menu
In Business Central navigate to the “Warehouse Insight Device Menus” page.
Choose the “Form” drop down option “Application”.
Choose the Application “SALES_OUT_DOC” from the lookup list.
Create a new Menu at the end with the following properties:
- Caption: Take Picture
- Event ID: 2000000
- Standard Action: Take Picture
2. Create the Extension
Create an extension codeunit to process the request and save the picture as an attachment.
Custom events must be handled before the base product execution occurs. Therefore, we will be subscribing to the “OnBeforeProcessEvent” and listening for the event defined on the Menu (ID 2000000).
The code for saving the attachment is given below. When done, the custom event must indicate the event was handled to avoid errors being generated by base Warehouse Insight.
Once the extension codeunit has been published comments can now be added via the “Add Comment” menu option on the document.