联系人(查找)是发票实体记录中的外键 GUID。如果不过滤您正在查找的联系人值,查询将导致您从顶部随机生成 10 个发票。
尝试在代码中设置 WHERE 条件。
例如:要通过 emailaddress1 属性过滤联系人,github中的示例如下所示:
$contactKey = new \AlexaCRM\CRMToolkit\KeyAttributes();
$contactKey->add( 'emailaddress1', $contactKeyValue );
另一个引用此示例的示例,您可以执行以下操作来过滤特定的父联系人。
/* Check the ID or AlexaCRM\CRMToolkit\KeyAttributes to retrieve the entity values */
if ($IDorKeyAttributes != null) {
/* Set EntityValues if specified Entity ID */
if (is_string($IDorKeyAttributes) && self::isGuid($IDorKeyAttributes)) {
/* Set the ID of Entity record */
$this->setID($IDorKeyAttributes);
/* Get the raw XML data */
$rawSoapResponse = $this->client->retrieveRaw($this, $columnSet);
/* NOTE: ParseRetrieveResponse method of AlexaCRM\CRMToolkit\AlexaSDK_Entity class, not the AlexaCRM\CRMToolkit\AlexaSDK class */
$this->parseRetrieveResponse($this->client, $this->LogicalName, $rawSoapResponse);
} else {
if ($IDorKeyAttributes instanceof KeyAttributes) {
if (version_compare($this->client->organizationVersion, "7.1.0", "<")) {
throw new Exception('Entity ID must be a valid GUID for the organization version lower then 7.1.0');
}
/* Set the keyAttributes array */
$this->keyAttributes = $IDorKeyAttributes;
/* Add the KeyAttribute values to the entity object values */
foreach ($IDorKeyAttributes->getKeys() as $key => $attribute) {
$this->propertyValues[$key] = array("Value" => $attribute, "Changed" => true);
}
/* Get the raw XML data */
try {
$rawSoapResponse = $this->client->retrieveRaw($this, $columnSet);
/* NOTE: ParseRetrieveResponse method of AlexaCRM\CRMToolkit\AlexaSDK_Entity class, not the AlexaCRM\CRMToolkit\AlexaSDK class */
$this->parseExecuteRetrieveResponse($this->client, $this->LogicalName, $rawSoapResponse);
} catch (SoapFault $sf) {
$errorCode = $sf->faultcode;
// undocumented feature
if ($errorCode == '-2147088239') {
$this->exists = false;
}
/* ToDo: Return exception with user-friendly details, maybe KeyAttribute parameters invalid */
}
}
}
}
注意:我不是 php 人,为了帮助你,我做了一些研究。