1

I want to get the html of pdf manager using bean. I know how to get the html for email template but unable to get the html for pdf template which u build in pdf manager.

    $template = new EmailTemplate();
    $template->retrieve_by_string_fields(array(‘name’ => $template_name,’type’=>’email’));
    $html=$template->body_html; 

How can i achieve the same functionality when i want to get the html template from pdf manager?

anila
  • 119
  • 2
  • 3
  • 8

1 Answers1

0

The retrieve_by_string_fields function is deprecated as of 7.6 as per this, so you might want to consider using SugarQuery instead. There's no "type" field in the PDF Manager, so I've just gone with the name attribute from your code. This should provide you with an array of records matching the condition.

require_once("include/SugarQuery/SugarQuery.php");
$sugarQuery = new SugarQuery();
$sugarQuery->select("body_html");
$sugarQuery->from(BeanFactory::newBean('PdfManager'));
$sugarQuery->where()->equals("name", $template_name);
$html = $sugarQuery->execute();
Reisclef
  • 2,056
  • 1
  • 22
  • 25