I want to create leads based on a SFDC custome field say "Domain__c'
I am using JAVA SOAP API 2.0 for syncing the lead . Here is the sample code -
HashMap<String, String> attrs = new HashMap<String, String>();
attrs.put("FirstName", "Kir");
attrs.put("LastName", "Gupta");
attrs.put("Email" , "nc.c@abc.com");
attrs.put("Company" , "isomecomapny");
attrs.put("Domain_Name__c" , "domain1234");
attrs.put("User_Name__c" , "K_user");
LeadRecord leadRec = MktowsUtil.newLeadRecord(null,null,null, "Domain_Name__c", attrs);
ResultSyncLead result = client.syncLead(leadRec, null, true);
// This is how I create a new record -
static public LeadRecord newLeadRecord(Integer Id, String Email, String fsysIdType, String fsysIdValue, HashMap<String, String> attributes) {
LeadRecord lr = MktowsUtil.objectFactory.createLeadRecord();
if (Id != null ) {
lr.setId(Id);
}
if (Email != null) {
lr.setEmail(Email);
}
lr.setForeignSysType(ForeignSysType.SFDC); // I set this yo SFDC , is it correct ?
if(fsysIdValue!=null)
{
lr.setForeignSysPersonId(fsysIdValue);
}
if (attributes != null && attributes.size() > 0) {
ArrayOfAttribute aoAttr = MktowsUtil.objectFactory.createArrayOfAttribute();
List<Attribute> attrList = aoAttr.getAttribute();
String attrName = null;
Iterator<String> it = attributes.keySet().iterator();
while (it.hasNext()) {
attrName = it.next();
attrList.add(MktowsUtil.newAttribute(attrName, attributes.get(attrName)));
}
lr.setLeadAttributeList(aoAttr);
}
return lr;
}
Everytime I specify a new domain Name the same old lead gets updated. I cannot create new lead. Can some one tell me what I am doing wrong ? Also if possible can saome one provide me a sample code for using foriegnSysPersonId as unique key.
Thanks,
Neha