package com.thysmichels;
import java.util.Date;
import com.sforce.soap.partner.*;
import com.sforce.soap.partner.sobject.*;
import com.sforce.ws.*;
public class ForcedotcomAWS {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//Create a new connectionconfig to your Salesforce Org
ConnectorConfig sfconfig = new ConnectorConfig();
//Use your salesforce username = email
sfconfig.setUsername("username");
//Use your saleforce password with your security token look like: passwordjeIzBAQKkR6FBW8bw5HbVkkkk
sfconfig.setPassword("passwordsecuritytoken");
PartnerConnection partnercon = null;
try {
// create a salesforce connection object with the credentials supplied in your connectionconfig
partnercon = Connector.newConnection(sfconfig);
SObject opportunity = new SObject();
opportunity.setType("Opportunity");
opportunity.setField("Name", "Persistent Salesforce Services");
Date clsdate = new Date();
opportunity.setField("CloseDate", clsdate);
opportunity.setField("StageName", "Qualification");
SaveResult[] sfoppresult = partnercon.create(new SObject[] { opportunity });
System.out.println("Created Opportunity: " + sfoppresult[0].getId());
} catch (ConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
0.000000
0.000000
Like this:
Like Loading...
Related
Published by Thys Michels
Cloud Architect - Salesforce and everything related
View all posts by Thys Michels