Salesforce has a merge function, but I don't think it has a function to systematically output candidate materials for name identification. I wrote a memo when I made a very simple name identification tool in Java.
Log in to Salesforce, configure, download WSDL from API (named wsdl.xml)
Access the following site and download the project file https://github.com/forcedotcom/wsc
Start Eclipse and import the downloaded file
Run, select Maven Build and enter Goal Package to create Jar
After creating, enter the following command. inputwsdlfile specifies the WSDL file downloaded above
Java command
java -jar target/force-wsc-42.0.0-uber.jar <inputwsdlfile> <outputjarfile>
Example) java-jar target/force-wsc-42.0.0-uber.jar wsdl.xml original.jar
Create a new project in Eclipse, select Maven project
Place the jar file created above in the project (This time, I created a lib file and placed it directly under it)
Add the Jar created above and related libraries to pom.xml
pom.xml
<dependency>
<groupId>net.original</groupId>
<artifactId>originalJar</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/original.jar</systemPath>
</dependency>
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-wsc</artifactId>
<version>42.0.0</version>
</dependency>
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-partner-api</artifactId>
<version>42.0.0</version>
</dependency>
App.java
package sfdc.api;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Calendar;
import com.sforce.soap.enterprise.EnterpriseConnection;
import com.sforce.soap.enterprise.QueryResult;
import com.sforce.soap.enterprise.sobject.Account;
import com.sforce.soap.enterprise.sobject.SObject;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
/**
* Salesforce Connect
*
*/
public class App
{
public static void main( String[] args )
{
ConnectorConfig config = new ConnectorConfig();
config.setUsername("Login ID");
config.setPassword("Password + security token");
//The version of Soap service will be updated, so refer to the following site
// https://help.salesforce.com/articleView?id=000126966&language=ja&type=1
String soapEndpoint = "https://login.salesforce.com/services/Soap/c/40.0";
config.setAuthEndpoint(soapEndpoint);
System.out.println("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
try {
EnterpriseConnection connection = new EnterpriseConnection(config);
QueryResult queryResults = connection.query("SELECT Id,Name,LastModifiedDate FROM Account Order by Name");
SObject[] records = queryResults.getRecords();
String beforeId = "";
String beforeName = "";
for(SObject record : records) {
String name = ((Account) record).getName();
String id = ((Account) record).getId();
Calendar lastModifiedDate = ((Account) record).getLastModifiedDate();
System.out.println("sfid{" + id + "}");
if(name.equals(beforeName)) {
fileWriter("Duplicate[" + beforeName + "], sfid{" + beforeId + "}");
fileWriter("Duplicate[" + name + "], sfid{" + id + "}");
}
beforeId = id;
beforeName = name;
}
System.out.println("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
} catch (ConnectionException ce) {
ce.printStackTrace();
}
}
private static void fileWriter(String name) {
try {
File f = new File("nayose.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(f, true));
bw.write(name);
bw.newLine();
bw.close();
} catch (IOException e) {
System.out.println(e);
}
}
}
Duplicate[Taro Tanaka], sfid{0017F10xxxxxxxxxx}
Duplicate[Taro Tanaka], sfid{0015A02xxxxxxxxxx}
Recommended Posts