Silent import in Sage X3



Silent import in Sage X3

To perform a silent import in Sage X3 with error catching, you can use a custom script to run the import and capture any errors that occur. Here is an example script that you can modify to fit your specific import:

$ACTION Case ACTION When "IMPORT" : Gosub IMPORT Endcase Return $IMPORT Local Integer iErr Local String sMsg Local String sFileName Local String sLogName sFileName = "C:\Sage\Imports\myimport.csv" ; Replace with the path to your import file sLogName = "C:\Sage\Imports\myimport.log" ; Replace with the path where you want to save the log file iErr = IMPORTSIL(sFileName, sLogName) If iErr <> 0 sMsg = ERRORMSG(iErr) MsgBox "Import failed with error: " + sMsg Else MsgBox "Import completed successfully" Endif Return 

In this script, the IMPORTSIL function is used to run the import in silent mode, which means that the user will not be prompted for any input and any errors will not be displayed on the screen. The function returns an error code, which is stored in the iErr variable. After running the import, the script checks the value of iErr. If it is not zero, an error message is displayed using the ERRORMSG function, which takes the error code as a parameter and returns a human-readable error message. If the import completes successfully (i.e., iErr is zero), a message is displayed indicating that the import was successful. Note that you will need to modify the sFileName and sLogName variables to match the paths where your import file and log file should be stored, respectively. You can save this script as a custom script (e.g., ZIMPORT) in the "Entry point AIMP3" section of the "General" tab of the import task. Then, when you run the import task, it will use your custom script to perform the import and capture any errors.