Useful Matt, along with
https://www.concursive.com/show/concoursesuite-support/wiki/Add+Contact+%26+related+information
But I'll admit I'm struggling to get any good results. I am actually trying to add an account and a contact for that account, actually, but I've gone back to running your sample code because I couldn't get that working. I've using the latest concoursesuite tools that you updated recently but even running (almost) exactly your sample code:
int clientId = 1;
boolean result;
CRMConnection crm = new CRMConnection();
crm.setUrl("http://man6:8080/crm");
crm.setId("man6");
crm.setCode("testing");
crm.setClientId(clientId);
crm.setAutoCommit(false);
// connection.setAutoCommit(false);
DataRecord contact = new DataRecord();
contact.setName("contact");
contact.setAction(DataRecord.INSERT);
contact.setShareKey(true);
contact.addField("nameFirst", "1st");
contact.addField("nameLast", "last");
contact.addField("company", "test coname");
contact.addField("title", "test title");
contact.addField("source", "test source");
contact.addField("isLead", "true");
contact.addField("accessType", 2);
contact.addField("leadStatus", 1);
contact.addField("enteredBy", 0);
contact.addField("modifiedBy", 0);
crm.save(contact);
// email
DataRecord email = new DataRecord();
email.setName("contactEmailAddress");
email.setAction(DataRecord.INSERT);
email.addField("email", "test@test.com");
email.addField("contactId", "$C");
email.addField("type", 1);
email.addField("enteredBy", 0);
email.addField("modifiedBy", 0);
crm.save(email);
result = crm.commit();
System.out.println(Boolean.toString(result));
I do not get a contact created that can be seen through the front end web application. I can see the record in the database underneath, however. The response I get on System.out.println is:
true <?xml version="1.0" encoding="UTF-8" standalone="no"?><aspcfs><response id="1"><status>0</status><errorText/><recordSet count="1" name="contact"><record action="processed"><nameFirst>1st</nameFirst><nameLast>last</nameLast><company>test coname</company><title>test title</title><source>-1</source><isLead/><accessType>2</accessType><leadStatus>1</leadStatus><enteredBy>0</enteredBy><modifiedBy>0</modifiedBy></record></recordSet></response></aspcfs>
JSESSIONID=99858BD1915563C449493C2A71FA6E22; Path=/crm
Which looks fine to me. I also get this in catalina.out:
[WARN] com.concursive.crm.indexer.LuceneIndexer - Class Not Found Exception. MESSAGE = com.concursive.crm.web.modules.contacts.dao.ContactEmailAddressIndexer
java.lang.ClassNotFoundException: com.concursive.crm.web.modules.contacts.dao.ContactEmailAddressIndexer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at com.concursive.crm.indexer.LuceneIndexer.getObjectIndexer(Unknown Source)
at com.concursive.crm.indexer.LuceneIndexer.indexAddItem(Unknown Source)
at com.concursive.crm.indexer.LuceneIndexer.indexAddItem(Unknown Source)
at com.concursive.crm.indexer.LuceneIndexer.indexAddItem(Unknown Source)
at com.concursive.crm.indexer.jobs.IndexerJob.execute(Unknown Source)
at org.quartz.core.JobRunShell.run(JobRunShell.java:206)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:548)
Twice. Irritating that your stack-traces that fill up catalina.out have no timestamps, btw
Is there any documentation on the variations of that "$C" structure, please? I've seen some variants on the forums.