This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to run a VBscript when import documents using External Source

Former Member
Former Member
Hi,

Im using EXTERNAL SOURCE feature to import PDF files using XML to get data, I need to import only PDF files that have a XML file, Im trying  using a event handler ( BeforeCreateNewObjectFinalize ) but it doesnt Works when import documents using EXTERNAL SOURCE, how can I resolve this issue ??

Regards,
Parents
  • Hi Manuel,

    Event handlers such as BeforeCreateNewObjectFinalize definitely run when using external sources. I've used them before (perhaps not BeforeCreateNewObjectFinalize, but event handlers in general) to do file analysis and metadata population as part of the import.

    However, I'm not sure you'll be able to trap whether an associated XML file exists or not at this point. The best you may be able to do is to tell M-Files to load metadata from the XML file and then have an event handler that ensures the metadata is loaded and throws an exception if it is not. I've not tried this before, but it may stop the file from being imported.

    Alternatively, can you intercept the file being written to the external source location and only copy it there if the XML file exists too?

    Craig.
Reply
  • Hi Manuel,

    Event handlers such as BeforeCreateNewObjectFinalize definitely run when using external sources. I've used them before (perhaps not BeforeCreateNewObjectFinalize, but event handlers in general) to do file analysis and metadata population as part of the import.

    However, I'm not sure you'll be able to trap whether an associated XML file exists or not at this point. The best you may be able to do is to tell M-Files to load metadata from the XML file and then have an event handler that ensures the metadata is loaded and throws an exception if it is not. I've not tried this before, but it may stop the file from being imported.

    Alternatively, can you intercept the file being written to the external source location and only copy it there if the XML file exists too?

    Craig.
Children
No Data