Introduction

In sourcing we don’t have any standard option for mass download of all the contract documents at a time from all the agreements. Only option we have that download the documents one by one manually. If we have 10 -15 documents, we can do it by manually but when we have huge number of documents to download it is very painful to download one by one and time consuming process also.

To overcome from above manual activity, we have built a custom explicitly called script and downloaded all the documents to FTP directly.

This blog intended to give the concept and customization details require for this.

Pre-Requisite Checks

Maintain File Transfer Configuration in Sourcing.

FTP configuration should test in sourcing prior to run the script.

FTP path should have required space to download the documents.

Development Overview/Technical Details

Step 1: Develop a custom query definition to get the agreements list with contract document name and unique document id. The query definition will look like below one. You can implement the query based on your requirement condition.

ftp.putFile( datafile, ftppath.getUrl() +agreementId+ ” – ” +attachment.getDisplayName() ); //Place the file in FTP path with required name, we saved the file in FTP with agreement id as prefix to identify easily.
ftp.close(); //always make sure you close the ftp client
}

Step 3: Create a schedule task to run the explicitly called script.

Step 4: Once task completed, check the files in FTP path.

Useful Information

You can test above script initially as normal script with Scripting Context as Document Life cycle Event, Class as Master Agreement (1004) and Target as Saved. You can pass only one contract and test it.

If there are any errors, you will be able to see while saving the agreement and resolve easily.

I gave example for Master Agreement in this presentation, same can be applicable to Sub Agreements as well.

In my example I used FTP, we have an option to use SFTP also. SFTP details need to be configured in FTC.

You can use Try – catch block to execute above script and capture the error.