EBSuite Support  shadow  Knowledge & FAQs    Learning Center  shadow  Tech Blog  shadow  Support Question?  shadow  Login to Case History  shadow
 


Knowledge Home | Functional Area | Web Service API |
Web Service API: my Phone, Email, Address, Notes are not saving
In EBSuite Web Service API, saving Phone / Email / Address / Notes / Custom Fields to the CRM is handled a bit differently than other entities. You will need to set the field "olLastUpdateDate" to a current datetime stamp, to tell our server that this record has been "touched".

.Net sample Code
===============

// SAMPLE CODE TO CREATE A NEW CONTACT WITH 1 EMAIL ADDRESS and 1 STREET ADDRESS
// contact service object
EbSuite.Psn.PsnAPIService oContactSvc = new PsnAPIService();

EbSuite.Psn.contact oNewContact = new EbSuite.Psn.contact(); // new empty contact object
oNewContact.firstName = "firstname";
oNewContact.lastName = "lastname";

// do an initial save with "base data"
//oNewContact.olLastUpdateDate = DateTime.Now.AddHours(-5);
//oNewContact = oContactSvc.saveContactRecord(GetSession(), oNewContact);

// pass state and country to an address object
EbSuite.Psn.cpAddress oConAddress = new EbSuite.Psn.cpAddress();
oConAddress.country = "USA";
oConAddress.state = "IL";
oConAddress.addrLine1 = "10 Main"; // address line 1 is required
oConAddress.olLastUpdateDate = DateTime.Now.Date;
oConAddress.olLastUpdateDateSpecified = true;
EbSuite.Psn.cpAddress[] oAddressList = new EbSuite.Psn.cpAddress[1]; // create an empty array of address objects
oAddressList[0] = oConAddress; // stash our address in the first index of the array
oNewContact.addresses = oAddressList;

// save the email address
EbSuite.Psn.cpEmail oConEmail = new EbSuite.Psn.cpEmail();
oConEmail.emailAddr = "myemail@email.com";
oConEmail.olLastUpdateDate = DateTime.Now;
oConEmail.olLastUpdateDateSpecified = true; // must set to true otherwise the proxy class will not include the olLastUpdateDate field in the HTTP Request
EbSuite.Psn.cpEmail[] oEmailList = new EbSuite.Psn.cpEmail[1]; // create empty array of email objects
oEmailList[0] = oConEmail; // pass our email object into the first index of the email array
oNewContact.emails = oEmailList;

// unsure if this is required, but it doesn't seem like it can hurt to include it
oNewContact.olLastUpdateDate = DateTime.Now;
oNewContact.olLastUpdateDateSpecified = true;

// save the new contact
oNewContact = oContactSvc.saveContactRecord(GetSession(), oNewContact);


// GET SESSION
private static string GetSession()
{
EbSuite.Auth.SessionAuthenticatorAPIService oAuthSvc = new SessionAuthenticatorAPIService();

// these values are gotten from the eb suite admin area:
// Main > Setup > Web Service APIs > Web Service APIs
string sSessionID = oAuthSvc.simpleAuthenticate("myID", "mykey");
return sSessionID.Substring(sSessionID.IndexOf(":") + 1);
}



Java Sample Code
======

Contact cnct = stub.getContactDetail( sessId, 777565 );
System.out.println( " return = " + cnct.getDisplayName() );

CpAddress addr = new CpAddress();
addr.setAddrLine1( "1 Test Blvd" );
addr.setOlLastUpdateDate( Calendar.getInstance() );
CpAddress[] oAddressList = new CpAddress[1]; // create an empty array of address objects
oAddressList[0] = addr; // stash our address in the first index of the array
cnct.setAddresses( oAddressList );

CpEmail eml = new CpEmail();
eml.setEmailAddr( "test@test.com" );
eml.setOlLastUpdateDate( Calendar.getInstance() );
CpEmail[] oEmailList = new CpEmail[1]; // create empty array of email objects
oEmailList[0] = eml; // pass our email object into the first index of the email array
cnct.setEmails (oEmailList);

BaseCustomFieldData cfd = new BaseCustomFieldData();
cfd.setFieldDefinition ( "Launch" );
cfd.setCfDataValue( "Test" );
cfd.setOlLastUpdateDate( Calendar.getInstance() );
BaseCustomFieldData[] oCustFieldsList = new BaseCustomFieldData[1];
oCustFieldsList[0] = cfd;
cnct.setCustomFields( oCustFieldsList );

cnct = stub.saveContactRecord( sessId, cnct );
 

Related Articles:
No related articles.
 
Attachments:
No attachment found for this article.
 
Was this article helpful?
 
 
Type: Knowledge Base
Tag(s): Web Services
Email a friend
Print this page


Back to Knowledge & FAQs page.


 
 
Powered by EBSuite.