salesforce not expected对象返回调用查询

时间:2013-05-14 12:09:07

标签: php salesforce

我正在使用sforce-php工具包从salesforce获取一些对象。我有以下代码:

$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
$mylogin = $mySforceConnection->login(USERNAME, PASSWORD.SECURITY_TOKEN);
$query = "SELECT FirstName from Contact";
$response = $mySforceConnection->query($query);
$queryResult = new QueryResult($response);

foreach ($queryResult->records as $record) {
    print_r($record);
    echo "<br/>";
}

我期望以这种形式返回对象:

stdClass Object
(
[type] = Contact
[Id] = Array
    (
        [0] =&gt; 003i0000009GZVzAAO
        [1] =&gt; 003i0000009GZVzAAO
    )
[FirstName] = "Some String" 
[any] = <sf:firstname>Some String</sf:firstname>
)

所以我可以得到对象的FirstName $ record-&GT;姓

但我得到的是:

stdClass Object
(
[type] = Contact
[Id] = Array
    (
        [0] =&gt; 003i0000009GZVzAAO
        [1] =&gt; 003i0000009GZVzAAO
    )
[any] = <sf:firstname>Some String</sf:firstname>
)

所以我无法获得FirstName。我有权访问的唯一属性是“any”。我怎样才能得到一个像预期的对象?我应该关注哪里?

1 个答案:

答案 0 :(得分:0)

确保您的帐户有权通过网络服务电话访问FirstName自定义字段。