ConcourseSuite Support

Support
Corporate
PUBLIC PROFILE

Back to topics

Discuss Development

Move uploaded File in a Ticket to a new Folder

You need to be logged in to post messages

Move uploaded File in a Ticket to a new Folder

1/9/2008 6:26 PM EST

We are trying to move a file uploaded to a ticket from the base documents folder into a folder that we just created. This is an example of one the xml requests we have tried:

// trans header ..
request+='<transaction id="1">';
request+='<meta>';
request+='<property>id</property>';
request+='</meta>';
request+='<fileItem action="update">';
request+='<id>248</id>';
request+='<folderId>' + folderId + '</folderId>';
request+='<enteredBy>' + userId + '</enteredBy>';
request+='<modifiedBy>' + userId + '</modifiedBy>';
request+='<subject>subject testing move</subject>'
request+='<linkItemId>' + ticketId + '</linkItemId>';
request+='<linkModuleId>6</linkModuleId>';
request+='</fileItem>';
request+='</transaction>';

we can query folders, create folders, upload files, query tickets ... but not this
could someone provide a working example of this. tomcat log

1. 1/9/2008 6:41 PM EST

response error message: <?xml version="1.0" encoding="UTF-8"?><aspcfs><response id="1"><status>1</status><errorText>Object validation errorfs>
Transaction failed
Object Validation Failed</errorText></response></aspcfs>

.. tomcat log:
TransactionItem-> org.aspcfs.modules.accounts.base.OrganizationList select
java.lang.Exception: Object Validation Failed
at org.aspcfs.modules.service.base.Transaction.execute(Unknown Source)
at org.aspcfs.modules.service.actions.ProcessPacket.executeCommandDefault(Unknown Source)
at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.darkhorseventures.framework.servlets.ControllerServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)

2. 1/10/2008 11:25 PM EST

using CRMConnection (from crm tools jar) I can insert a fileItem record, but update gives me a class cast exception Boolean.

This works:
CRMConnection crmConnection = initConnection();

final DataRecord fileItem = new DataRecord();
fileItem.setAction(DataRecord.INSERT);

fileItem.setName("fileItem");
fileItem.setShareKey(true);

fileItem.addField("folderId", 50);
fileItem.addField("clientFilename", "empty file testing move");
fileItem.addField("filename", "99999999999999");
fileItem.addField("size", 512);
fileItem.addField("linkItemId", 261);

fileItem.addField("subject", "testing file move");
fileItem.addField("linkModuleId", 6);
fileItem.addField("enteredBy", 5);
fileItem.addField("modifiedBy", 5);

crmConnection.save(fileItem);
crmConnection.commit();

This does not:
CRMConnection crmConnection = initConnection();

final DataRecord fileItem = new DataRecord();
fileItem.setAction(DataRecord.UPDATE);

fileItem.setName("fileItem");

fileItem.addField("id", 287);

fileItem.addField("folderId", 50);
fileItem.addField("linkItemId", 261);
fileItem.addField("linkModuleId", 6);
fileItem.addField("enteredBy", 5);
fileItem.addField("modifiedBy", 5);
fileItem.addField("defaultFile", false);
fileItem.addField("allowPortalAccess", false);

crmConnection.save(fileItem);
crmConnection.commit();

TransactionItem-> com.zeroio.iteam.base.FileItem update
java.lang.ClassCastException: java.lang.Boolean
at org.aspcfs.modules.service.base.TransactionItem.execute(Unknown Source)
at org.aspcfs.modules.service.base.Transaction.execute(Unknown Source)
at org.aspcfs.modules.service.actions.ProcessPacket.executeCommandDefault(Unknown Source)

3. 1/14/2008 2:08 AM EST

SOLUTION.
Please refer to issue 181 in the 4.1 branch issue tracking system. folder id was commented out in ProcessDocument.java. we uncommented this line redeployed and now we can upload a doc and save to a folder in a ticket.
So we are not moving a doc but saving it to the right place to start with.

3 results found