Here's the error message I get when trying to retrieve an attachment or document attachment. I am using this for documents called Onboarding. Any idea what's wrong?
namespace Espo\Custom\EntryPoints; use \Espo\Core\Exceptions\NotFound; use \Espo\Core\Exceptions\Forbidden; use \Espo\Core\Exceptions\BadRequest; class Onboarding extends \Espo\Core\EntryPoints\Base { public static $authRequired = true; // default action public function run() { // excecute actions invoked, if none specified throw error if(empty($_GET['action'])) { throw new BadRequest(); } else { $action = $_GET['action']; } switch ($action) { case 'getTemplateIdByOnboarding': if (empty($_GET['onboardingId'])) { throw new BadRequest(); } else { $tenancyId = $_GET['onboardingId']; } $tenancyObject = $this->getEntityManager()->getRepository('Onboarding')->where(['id'=>$onboardingId,'status'=>'Active'])->findOne(); $templateObject = $this->getEntityManager()->getRepository('Template')->where(['id'=>$onboardingObject->get("templateId")])->findOne(); $templateData['templateId'] = $templateObject->get('id'); echo(json_encode($templateData)); break; default: //code to be executed if $action is different from all labels; } } }
namespace Espo\Custom\EntryPoints; use \Espo\Core\Exceptions\NotFound; use \Espo\Core\Exceptions\Forbidden; use \Espo\Core\Exceptions\BadRequest; class Onboarding extends \Espo\Core\EntryPoints\Base { public static $authRequired = true; // default action public function run() { // excecute actions invoked, if none specified throw error if(empty($_GET['action'])) { throw new BadRequest(); } else { $action = $_GET['action']; } switch ($action) { case 'getTemplateIdByOnboarding': if (empty($_GET['onboardingId'])) { throw new BadRequest(); } else { $tenancyId = $_GET['onboardingId']; } $tenancyObject = $this->getEntityManager()->getRepository('Onboarding')->where(['id'=>$onboardingId,'status'=>'Active'])->findOne(); $templateObject = $this->getEntityManager()->getRepository('Template')->where(['id'=>$onboardingObject->get("templateId")])->findOne(); $templateData['templateId'] = $templateObject->get('id'); echo(json_encode($templateData)); break; default: //code to be executed if $action is different from all labels; } } }
Comment