Last active
November 11, 2015 15:27
-
-
Save tyoshikawa1106/49e2d6f8dc5678cdc100 to your computer and use it in GitHub Desktop.
Salesforce & Java Sample Code
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 com.tyoshikawa1106; | |
import com.sforce.soap.partner.*; | |
import com.sforce.soap.partner.sobject.*; | |
import com.sforce.ws.*; | |
public class HelloController { | |
public static void main(String[] args) { | |
ConnectorConfig config = new ConnectorConfig(); | |
config.setUsername("<Salesforce Login ID>"); | |
config.setPassword("<Salesforce Login Password>"); | |
try { | |
PartnerConnection connection = Connector.newConnection(config); | |
SObject account = new SObject(); | |
account.setType("Account"); | |
account.setField("Name", "My Account"); | |
connection.create(new SObject[]{account}); | |
} catch (ConnectionException ce) { | |
ce.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment