Document Versioning?

Hi all,

Bit of an update…I looked into the ECM REST API and EPICOR wanted to charge 100% of licence cost for annual maintenance which goes completely against every other licence model. because of this I was unable to pursue this further.

I have recently come into a requirement to somehow be able to create document version in a workflow and have come up with a bit of a work around, this is not ideal but it does work.

Note that this is only in my test environment and I am not 100% committed to using this as yet until properly tested, it is a bit of a hack.

I use the DocAttach data link to add my document to EPICOR ERP. The problem we have here is that the FileName used by DocAttach is a Guid thisis XfileName as opposed to XfileDesc and this is why it will never create a new version as the Guid is unique every time.

What I do is download the file and re-upload using API Calls in ERP to check for and create versions. There are issues with this, in particular that the newly uploaded version will not be linked to the original workflow so the history will not be there.

I have created a function in ERP which is triggered when a new row is added in the XFileRef table.

I examine the document type and file description to help me identify what I want to do with it.

I pass the XFileRefNum into my function and it does the following:

uses the DocStarDownloadFile method to download the document to a temporary location.

Then uses the DocStarFileExistsForTableRow method to see if a version already exists.

Then if version exists I use DocStarUploadFileAsVersion method

If the version does not exist then I use DocStarUploadFile and then the appropriate method to create the ERP Attachment.

This does kind of work. In theory, it could be donw by not even downloading the file as the Download method returned a byte array I think I could pass this byte array directly back into Upload methods, but I have not yet tried this.

Anyway, not sure if this helps anyone, I am not totally sure it helps me as yet :rofl: but I just though I would share.

3 Likes