Add Contact & related information
Using Centric Tools
// Establish connectivity information CRMConnection crm = new CRMConnection(); crm.setUrl("http://www.yourorg.com/centric"); crm.setId("www.yourorg.com"); crm.setCode("password"); crm.setClientId(clientId); DataRecord contact = new DataRecord(); contact.setName("contact"); contact.setAction(DataRecord.INSERT); contact.setShareKey(true); contact.addField("nameFirst", bean.getNameFirst()); contact.addField("nameLast", bean.getNameLast()); contact.addField("company", bean.getCompanyName()); contact.addField("title", bean.getTitle()); contact.addField("source", bean.getSourceId()); 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", bean.getEmail()); email.addField("contactId", "$C{contact.id}"); email.addField("type", 1); email.addField("enteredBy", 0); email.addField("modifiedBy", 0); crm.save(email); //phone DataRecord phone = new DataRecord(); phone.setName("contactPhoneNumber"); phone.setAction(DataRecord.INSERT); phone.addField("number", bean.getPhone()); phone.addField("contactId", "$C{contact.id}"); phone.addField("type", 1); phone.addField("enteredBy", 0); phone.addField("modifiedBy", 0); crm.save(phone); DataRecord address = new DataRecord(); address.setName("contactAddress"); address.setAction(DataRecord.INSERT); address.addField("streetAddressLine1", bean.getStreetAddressLine1()); address.addField("streetAddressLine2", bean.getStreetAddressLine2()); address.addField("streetAddressLine3", bean.getStreetAddressLine3()); address.addField("streetAddressLine4", bean.getStreetAddressLine4()); address.addField("contactId", "$C{contact.id}"); address.addField("type", 1); address.addField("city", bean.getCity()); address.addField("state", bean.getState()); address.addField("zip", bean.getZip()); address.addField("country", bean.getCountry()); address.addField("enteredBy", 0); address.addField("modifiedBy", 0); address.addField("primaryAddress", true); crm.save(address); boolean result = crm.commit();
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <app> <authentication> <id>www.yourorg.com</id> <systemId>4</systemId> <code>+++ CLIENT'S PASSWORD +++
<clientId>+++ CLIENT ID ALREADY ESTABLISHED +++</clientId>
</authentication>
<transaction id="1">
<contact action="insert" shareKey="true">
<nameFirst>John</nameFirst>
<nameLast>Doe</nameLast>
<company>XXX</company>
<title>XXX</title>
<accessType>2</accessType>
<enteredBy>0</enteredBy>
<modifiedBy>0</modifiedBy>
</contact>
<contactEmailAddress action="insert">
<email>john.doe@xxx.com</email>
<contactId>$C</contactId>
<type>1</type>
<enteredBy>0</enteredBy>
<modifiedBy>0</modifiedBy>
</contactEmailAddress>
<contactPhoneNumber action="insert">
<number>8888888888</email>
<contactId>$C</contactId>
<type>1</type>
<enteredBy>0</enteredBy>
<modifiedBy>0</modifiedBy>
</contactPhoneNumber>
<contactAddress action="insert">
<contactId>$C</contactId>
<type>1</type>
<streetAddressLine1>200 Yoakum Pkwy</streetAddressLine1>
<streetAddressLine2>Apt 444</streetAddressLine2>
<streetAddressLine3></streetAddressLine3>
<streetAddressLine4></streetAddressLine4>
<city>Alexandria</city>
<state>VA</state>
<zip>22345</zip>
<country>USA</country>
<enteredBy>0</enteredBy>
<modifiedBy>0</modifiedBy>
<primaryAddress>true</primaryAddress>
</contactAddress>
</transaction>
</app>
</code>
Sign in to add your comment.