on 11-18-2014 8:40 AM
Hi All,
I am trying to extract all contract documents in CLM application to a folder. Can anyone please share the steps to accomplish this?
Thanks,
Saloni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
I have gone through this post. I require to download all the attachments in the CLM application, and according to the post I would require to run the script on each contract to get it downloaded. I want some solution through which I can download the entire contract documents.
I tried writing a toolbar script as below, but its not working.
//Script
parentBean=doc.getParentIBean();
parentObjRef=doc.getExtensionField("PARENT").get();
parentClassId = parentObjRef.getClassId();
IapiDbHandleIfc dbHandle = session.getDbHandle();
try
{
if(parentClassId == 1003){
st = "SELECT T3.UNIQUE_DOC_NAME, T3.FILE_DATA FROM FCI_AGREEMENT T1 JOIN FCI_ATTACHMENT_SUB T2 ON (T2.PARENT_OBJECT_ID = T1.ObjectId) JOIN FCI_ATTACHMENT_BLOB T3 on (T3.PARENT_OBJECT_ID = T2.ObjectId)";
}
else if(parentClassId == 1004){
st = "SELECT T3.UNIQUE_DOC_NAME, T3.FILE_DATA FROM FCI_CONTRACT T1 JOIN FCI_ATTACHMENT_SUB T2 ON (T2.PARENT_OBJECT_ID = T1.ObjectId) JOIN FCI_ATTACHMENT_BLOB T3 on (T3.PARENT_OBJECT_ID = T2.ObjectId)";
}
java.sql.PreparedStatement ps = dbHandle.prepareStatement(st);
dbHandle.beginTransaction();
dbHandle.executeQuery(ps);
for(; dbHandle.next(); Logger.info(logMsg))
{
//InputStream FileData = dbHandle.getBinaryStream (2);
FileOutputStream file = null;
fileName = dbHandle.getString(1);
byte[] bytes = dbHandle.getBytes(2);
try
{
file = new FileOutputStream (fileName);
file.write(bytes);
}
catch (Exception e)
{
String err = e.toString();
System.out.println("File ERROR *** "+err);
}
finally
{
if(file != null)
file.close();
}
logMsg.setLogMessage(" File Name " + fileName);
}
dbHandle.endTransaction();
if (ps != null)
{ ps.close(); }
}
catch(Exception e)
{
logMsg.setException(e);
Logger.error(logMsg);
}
//End of Script
Please provide inputs.
Thanks,
Saloni
Hi Saloni,
As per my understanding of your requirement, follow the below steps:
1. Write a query which will fetch all the MAs depending upon the condition
2. Create a explicit script.
3. You have to call the query which will get all the MAs depending on the condition in the script. Write the logic in the script that what you want to achieve.
4. Create a Schedule job and call the explicit script.
5. Run the Job.
Below the blog which will guide you how to use Query IAPIs
Hope it helps.
Thanks
Kushagra A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.