top / index / prev / next / target / source
日記形式でつづる いがぴょんコラム ウェブページです。
public static EnterpriseConnection getEnterpriseConnection() throws ConnectionException {
final ConnectorConfig connConfig = new ConnectorConfig();
connConfig.setUsername("UserName");
connConfig.setPassword("password");
connConfig.setAuthEndpoint("https://test.salesforce.com/services/Soap/c/37.0");
return new EnterpriseConnection(connConfig);
}
public static Contact getContact(final EnterpriseConnection conn, final String queryName)
throws ConnectionException {
// TODO queryName がエスケープ処理されていること。
final QueryResult qResult = conn
.query("select id, name, SystemModstamp from Contact where name like '%" + queryName + "%'");
final SObject[] records = qResult.getRecords();
for (int index = 0; index < records.length; index++) {
final Contact lookup = (Contact) records[index];
System.out.println("Contact: " + lookup.getName() + " (" + lookup.getId() + ")");
// return first record.
return lookup;
}
return null;
}