ConcourseSuite Support


Back to topics

Discuss Development

Java source API examples

You need to be logged in to post messages

Java source API examples

4/6/2011 11:45 AM EDT
Default user photo

By Matt Rajkowski

Concursive Corporation
Product Design


There are some Java source API examples that I just ran across if you are interested.

In particular there is which demonstrates retrieving lookup values from the CRM and using them when inserting a new account. There are some important concepts that demonstrate related data and using default values.

1. 4/15/2011 10:49 AM EDT

Useful Matt, along with

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();

// connection.setAutoCommit(false);

DataRecord contact = new DataRecord();
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);;

// email
DataRecord email = new DataRecord();
email.addField("email", "");
email.addField("contactId", "$C");
email.addField("type", 1);
email.addField("enteredBy", 0);
email.addField("modifiedBy", 0);;

result = crm.commit();

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(
at org.apache.catalina.loader.WebappClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
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 Source)
at org.quartz.simpl.SimpleThreadPool$

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.

2. 4/25/2011 11:46 AM EDT
Default user photo

By Matt Rajkowski

Concursive Corporation
Product Design



The API response is good... no error. Contact records must have a specific module accessType (Leads, General Contact, Account Contact, Employee)... can you manually enter a Lead into the app and do a DIFF between the API record in the database? It could be a field value that needs to be set on the import.

The indexer warning about ContactEmailAddressIndexer is ok... it's a general warning generated out of the global indexer (used to index any defined types) and the CRM doesn't have one for that object.

3. 4/25/2011 2:37 PM EDT

As you can see from my (your) code we set

contact.addField("accessType", 2);

That record exists and is not disabled in lookup_access_types. I've tried it with 1 as well. Same failure. Finally got your code working by removing the lines

contact.addField("isLead", "true");
contact.addField("leadStatus", 1);

This record now shows up in the Contacts tab in the web page but when you click on it the following error shows in the web page:

java.sql.SQLException: ID not specified for lookup.
at com.concursive.crm.web.modules.contacts.dao.Contact.checkEnabledOwnerAccount(Unknown Source)
at com.concursive.crm.web.modules.contacts.actions.ExternalContacts.executeCommandContactDetails(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.concursive.crm.web.controller.servlets.ControllerServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(

Why does this method of data entry not have some kind of validation?

Also is there any documentation on the variations of that "$C" structure, please? I've seen some variants on the forums.

4. 5/20/2011 9:57 AM EDT


4 results found