/** * Creates a record list from a saved report * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array. * @param $args array The arguments array passed in from the API containing the module and the records * @throws SugarApiExceptionNotAuthorized * @throws SugarApiException * @return array id, module, records */ public function createRecordList($api, $args) { $this->requireArgs($args, array("record")); $savedReport = BeanFactory::newBean("Reports"); if (!$savedReport->ACLAccess('access')) { throw new SugarApiExceptionNotAuthorized(); } $recordIds = $this->getRecordIdsFromReport($args["record"]); $id = RecordListFactory::saveRecordList($recordIds, "Reports"); $loadedRecordList = RecordListFactory::getRecordList($id); return $loadedRecordList; }
/** * To create a record list * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array. * @param $args array The arguments array passed in from the API containing the module and the records * @return array id, module, records */ public function recordListCreate($api, $args) { $seed = BeanFactory::newBean($args['module']); if (!$seed->ACLAccess('access')) { throw new SugarApiExceptionNotAuthorized(); } if (!is_array($args['records'])) { throw new SugarApiExceptionMissingParameter(); } $id = RecordListFactory::saveRecordList($args['records'], $args['module']); $loadedRecordList = RecordListFactory::getRecordList($id); return $loadedRecordList; }