Microsoft Dynamics NAV includes predefined document handlers that handle incoming request documents from mobile devices that run Microsoft Dynamics® Mobile - Mobile Sales. The document handlers are defined as global functions in a codeunit. You can customize the predefined document handlers or you can create new document handlers. For more information, see Defining Document Handlers in Microsoft Dynamics NAV.

Document Handlers for Activities and Sales Orders

Microsoft Dynamics NAV includes four predefined document handlers for sales documents. The document handlers are defined in codeunit 8725 Mobile Sales Document Handler. Each document handler consists of two functions: to read the incoming XML document and to execute business logic in Microsoft Dynamics NAV. The following table describes the predefined document handlers.

Document handler Description

CreateActivityHandle

Handles requests to create new activities.

CreateActivityHandle reads the incoming XML document, verifies permissions, saves the document as a new record in the mobile document queue, and then calls CreateActivityNodeHandle with the request document from the mobile document queue, the XML content, and a variable for the To-do table.

CreateActivityNodeHandle inserts a new record in the To-do table with the data from the request document, and it creates a new record in the Attendee table.

ModifyActivityHandle

Handles requests to update existing activities.

ModifyActivityHandle reads the incoming XML document, verifies permissions, saves the document as a new record in the mobile document queue, and then calls ModifyActivityNodeHandle with the request document from the mobile document queue, the XML content, and a variable for the To-do table.

ModifyActivityNodeHandle retrieves the record from the To-do table that must be modified, and then validates the field values in the request document against the values in the existing record. If the function must update the existing to-do, the record is flagged as modified.

DeleteActivityHandle

Handles requests to delete activities.

DeleteActivityHandle reads the incoming XML document, verifies permissions, saves the document as a new record in the mobile document queue, and then calls DeleteActivityNodeHandle with the request document from the mobile document queue, the XML content, and a variable for the To-do table.

DeleteActivityNodeHandle retrieves the record from the To-do table that must be deleted, and then sets the Canceled field to True.

CreateOrderHandle

Handles requests to create new sales orders, including signature and sales order lines.

CreateOrderHandle reads the incoming XML document, verifies permissions, saves the document as a new record in the mobile document queue, and then calls CreateOrderNodeHandle with the request document from the mobile document queue, the XML content, and a variable for the Sales Header table.

CreateOrderNodeHandle inserts a new record in the Sales Header table with data from the request document, including customer number, dates, currency, and the salesperson code, which is retrieved from the Mobile User table. If the customer signed the sales order, the signature is saved to the Signature field as a BLOB. CreateOrderNodeHandle then creates a record in the Sales Line table for each order line in the request document.

Before a document handler can process incoming request documents, you must define a document type. For more information, see How to: Set Up Mobile Document Types in Microsoft Dynamics NAV Classic. Microsoft Dynamics NAV includes a number of predefined document types for Mobile Sales that you can use or modify.

See Also