正如标题所示,我希望使用PHP工具包批量删除一些保存的搜索。我以前曾使用该工具包删除过不同的记录类型,但似乎无法使其用于保存的搜索。下面是执行肮脏工作的代码:
foreach ($sea_del as $rec) {
$deleteRec = new RecordRef();
$deleteRec->typeId = $rec['recordtype'];
$deleteRec->internalId = $rec['id'];
$delete = new DeleteRequest();
$delete->baseRef = $deleteRec;
$delResponse = $service->delete($delete);
print_r ($delResponse);
}
$ rec看起来像这样:
Array
(
[id] => 1223
[recordtype] => savedsearch
[columns] => Array
(
[title] => Sales by Reporting Category
[id] => customsearch1223
[recordtype] => Transaction
[owner] => XXXX
[access] => Public
[lastrunby] => Array
(
[name] => xxxx
[internalid] => 54
)
[lastrunon] => 12/6/2013 3:29 pm
[isinactive] =>
)
)
如果我按上述方式运行脚本,则会收到此错误:
DeleteResponse Object
(
[writeResponse] => WriteResponse Object
(
[status] => Status Object
(
[statusDetail] => Array
(
[0] => StatusDetail Object
(
[code] => RCRD_TYPE_REQD
[message] => The record type is required.
[type] => ERROR
)
)
[isSuccess] =>
)
[baseRef] => RecordRef Object
(
[internalId] => 1223
[externalId] =>
[type] => platformCore:RecordRef
[name] =>
)
)
)
如果将$ deleteRec-> typeId更改为$ deleteRec-> type,则会出现致命错误,提示“ savedsearch不是RecordType的合法值”。
很多Google搜索使我相信保存的搜索可能无法实现,但是我希望我只是在犯一个愚蠢的错误。任何帮助将不胜感激。