如何从salesforce检索所有潜在客户字段


How to retrieve all lead fields from salesforce?

我正在使用salesforce Enterprise api在salesforc中添加潜在客户。

    $SFDCUSERNAME = "myusername";
    $SFDCPASSWORD = "mypassword!";
    $SFDCSECURITY_TOKEN = "mytoken";
    $SFDCCLIENT = "soapclient/SforceEnterpriseClient.php";
    $SFDCWSDL = "soapclient/enterprise.wsdl.xml";
require_once($SFDCCLIENT);
try {
    $mySforceConnection = new SforceEnterpriseClient();
    $myConnection = $mySforceConnection->createConnection($SFDCWSDL);
    $myLogin = $mySforceConnection->login($SFDCUSERNAME, $SFDCPASSWORD.$SFDCSECURITY_TOKEN);

}
catch(Exception $e) {
    print_r($e);
}

我可以使用api创建潜在客户。现在,我想检索salesforce中潜在客户可用的所有字段(不仅是自定义字段,还有默认的/in_builded字段),并将其显示在HTML下拉字段中。

是否可以使用salesforceApi检索潜在客户的所有字段?

经过长时间的搜索,我得到了一个答案,它对我来说很有效。我把它发布在这里,希望它能对其他人有所帮助。

try {
        $mySforceConnection = new SforceEnterpriseClient();
        $myConnection = $mySforceConnection->createConnection($SFDCWSDL);
        $myLogin = $mySforceConnection->login($SFDCUSERNAME, $SFDCPASSWORD.$SFDCSECURITY_TOKEN);
        echo "<pre>";
        print_r($mySforceConnection->describeSObject('Lead'));
        echo "</pre><br>";       
    }
    catch(Exception $e) {
        print_r($e);
    }

salesforce api describeSObject()中有一个函数,它输出有关对象的完整详细信息,包括字段详细信息。

参考