Monitoring the Import Progress
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
To monitor the progress of the import, run the import operation on the main thread by using one of the following messages:
- ImportXmlWithProgress
- ImportCompressedXmlWithProgress
- ImportTranslationsXmlWithProgress
- ImportCompressedTranslationsXmlWithProgress
Query the results of the import on the second thread, in a loop with a Sleep delay (1 second) between each call.
Example
The following sample shows how to calculate the percentage of completed blocks during import.
[Jscript]
// Calculate the total number of blocks and the processed number of blocks.
var oDataXml = loadXmlDocument(oImportJob.data);
var oAllNodes = oDataXml.selectNodes("//entity | //node | //setting | //securityrole | //workflow ");
var oCompletedNodes = oDataXml.selectNodes("//entity[@result] | //node[@result] | //setting[@result] | //securityrole[@result] | //workflow[@result]");
iTotalBlocks = oAllNodes.length;
iTotalProcessed = oCompletedNodes.length;
var iPercentage = iTotalProcessed *100 /iTotalBlocks;
See Also
Other Resources
.gif)