Created
November 2, 2022 17:51
-
-
Save BetterProgramming/7afe0bc4824a9487a24368a1b434e59d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wsc; | |
// Depending on wsdl chosen, change this to enterprise or partner | |
import com.sforce.soap.enterprise.*; | |
import com.sforce.soap.enterprise.sobject.*; | |
import com.sforce.ws.*; | |
public class Main { | |
public static void main(String[] args) { | |
ConnectorConfig credentials = new ConnectorConfig(); | |
credentials.setPassword("YourPassword!apPenDdedSecurityToken); | |
credentials.setUsername("yoursalesforceusername@yourdomain.com"); | |
EnterpriseConnection connection; | |
try { | |
connection = Connector.newConnection(credentials); | |
Lead le = new Lead(); | |
le.setLastName("AcmeEnterprises"); | |
le.setCompany("JavaPush"); | |
le.setIndustry("Hospitality"); | |
connection.create(new Lead[]{ le }); | |
} catch (ConnectionException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment