RUN Function (XMLport)
Loads and executes the XMLport that you specify.
XMLport.RUN (Number [, ReqWindow] [, Import] [, Record])
The variable is automatically cleared after this function runs.
Specifies the XMLport to run.
Specify true to show request page; specify false to run the report and skip the request page.
This parameter overrides the setting of the UseRequestPage Property of the XMLPort. If you do not provide a value for the ReqWindow parameter, then the setting of the UseRequestPage property is used.
Microsoft Dynamics NAV Web client does not support request pages with XMLports. If the XMLPort will appear in the Microsoft Dynamics NAV Web client, you should set the value to false; otherwise, you will get an error at runtime.
Specifies whether the XMLPort imports or exports data. Specify true to run the XMLport and import data; specify false to export data.
This parameter is most relevant when the XMLport does not use a request page and the Direction Property of the XMLport is set to Both. In this instance, you use the parameter to specify the direction of the data. If the XMLport uses a request page, then a direction option appears on the request page that enables the user can choose to import or export data. The Import parameter specifies the default value in the direction on option on the request page.
If the Direction property is set to Import or Export, then you must set this parameter to match the direction that is set by the Direction property; otherwise, you will get an error at runtime.
The default is true.
The record to use in the XMLport. The system will use any filters that are attached to the specified record.
The following example creates a codeunit that runs the XMLport that has ID 50002, runs a request page that lets the user set filters, and exports data from the Customer table. On the request page, you can either open the file and view it or save it as an XML document on your computer. This example assumes that you have created an XMLport and saved it with ID 50002. For more information about how to create an XMLport, see How to: Create XMLports. This example requires that you create the following variable in the C/AL Globals window.
XMLPORT.RUN (50002, TRUE, FALSE, varRec);