You need to sign in to do that
Don't have an account?
Problem in Creating Account
Folks
I have the following code to create an Account in Salesforce.com, I have created an new custom field called Account Id in Account Object...
1) Logs in Successfull - No problem
2) Querying for the fields in Account Object - No problem
accountQuery = bindingStub
.query("select Id,AccountNumber,Account_Id__c from Account");
sObjects = new SObject[1];
if (accountQuery.isDone()) {
// Iterate through the records and process them
for (int i = 0; i < accountQuery.getRecords().length; i++) {
Account acct = (Account) accountQuery.getRecords(i);
String acctNumber = acct.getAccountNumber();
String webSite = acct.getWebsite(); // just for testing...
String acctId = acct.getAccount_Id__c();
Actually testId is hardcoded...i just want to test if i can able to create an account..I check testId against the acctId(custom field in Account Object) , If its equals i just update the Account Info or Create an New Account, Here in My case it is going in to the ELSE loop ...but when i logged in to my Developer Edition ,I don't see any accounts with Name= Norvergence..
if (testId == acctId) {
System.out.println("inside IF LOOP");
// do update on the existing info in salesforce
} else {
// create an account in salesforce
acct.setAccount_Id__c(testId);
acct.setName("Norvergence");
sObjects[0] = acct;
try {
System.out.println("creating objects");
saveResults = bindingStub.create(sObjects);
} catch (UnexpectedErrorFault e1) {
e1.printStackTrace();
} catch (InvalidSObjectFault e1) {
e1.printStackTrace();
} catch (RemoteException e1) {
e1.printStackTrace();
}
Please let me know if i am doing any mistake in calling the right method..