...
A process class must be created for the export process, extending com.crm.process.CRMExportBean. Below, you can see the implementation of an example export process class. It is recommended to use the LogTextFile method to log the export process results for easier debugging of the process.
If export criteria are defined in the exports.xml metadata file, then their values can be retrieved and used from the process run log's process run definition, using the loadCustomExportActionInputsFromXML method of the ProcessRunDefinitionXMLUtilBean class.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
public class EXAMPLEExportBean extends CRMExportBean { ... public void export(String processRunLogID) throws Exception { CallList.LogTextFile(getCRMSession(), "Example Export start processing (" + processRunLogID + ")", "exportExample",""); CRMDOProcessRunLog processRun = (CRMDOProcessRunLog)processRunLogBean.load(processRunLogID); processRun.setStatus(ProcessRunLogStatus.IN_PROGRESS); processRun.setStartDate(getCurrentDate()); processRunLogBean.save(processRun); Boolean processComplete = new Boolean(false); try { exportInExcelFormat(processRun); processComplete = new Boolean(true); } catch (Exception e) { CallList.LogTextFile(getCRMSession(), "Error on processing export (" + processRunLogID + ")" + ExceptionUtil.getStackTrace(e), "exportExample",""); processRun.setStatus(ProcessRunLogStatus.FAILED); processRunLogBean.save(processRun); } if (processComplete) { processRun.setStatus(ProcessRunLogStatus.COMPLETED); processRun.setEndDate(getCurrentDate()); processRunLogBean.save(processRun); } CallList.LogTextFile(getCRMSession(), "Example Export end processing (" + processRunLogID + ")", "exportExample",""); } ... } |
...