• Kaushik_Support
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hello, I am trying to show full HTML email template with header and footer on my visualforce page. I took htmlvody field of Email template objectbut it just returned the html code of body section. How can i retrieve the full code for html body along with header and footer. Any urgent help will be useful. Thanks, Ray
Hello, I am trying to populate email template merge field values and display them in my VF page. but not able to make it happen. Any pointer will be helpful. Thanks, Ray

Hello, I am trying to escape a rich textArea field to be shown in a visualforce page.

Right now, it's escaped using {!HTMLENCODE()}.

What I am trying to do is to allow a set of HTML tags, but only in some cases.

 

What I am looking for, ideally, is a way to call the HTMLENCODE function from apex code most of the time, and then implement my own escaping method for the cases that allow some HTML tags. What I am trying to avoid is re-implementing HtmlEncode in my classes.

 

So, the question is : is there a way to access the HTMLENCODE visualforce function from Apex code? If not, is there a functionally equivalent alternative I can reuse?

 

Any help will be appreciated, thanks!

 

Horacio

I'm building a custom agent integration where I need to search several different article types at the same time.  As I've added on two more article types than the default FAQ, I hit a small issue.  The 3rd document type, Link, never returns in search results via Apex.

 

Here's the code relevant to the query:

 

Public Static List<List<sobject>> searchDocs(string keywords, string productcode, string langcode, integer numresults){	
	//make the search terms SOSL injection safe
	keywords = String.escapeSingleQuotes(keywords);
	
	//ensure categories are never null
	if(productcode == '' || productcode == NULL){productcode = 'AllProducts';}
	if(langcode == '' || langcode == NULL){langcode = 'en';}
	if(numresults > 100){numresults = 100;}	/** cap the results at 100 for performance */
	if(numresults < 1 || numresults == NULL){numresults = 5;}	/** set a default of 5 */
	
	//add the __c requried for custom data category names
	productcode = productcode + '__c';
	langcode = langcode + '__c';
	string query = 'FIND \'' + '*' + keywords + '*' + '\'' +
		'IN ALL FIELDs Returning ' + 
		'FAQ__kav(ID, Title, Localized_Title__c, UrlName WHERE PublishStatus = \'Online\'), ' + 
		'Documentation__kav(ID,Title, Localized_Title__c, UrlName WHERE PublishStatus = \'Online\'), ' +
		'Link__kav(ID,Title,Localized_Title__c,UrlName WHERE PublishStatus = \'Online\') ' +
		'WITH DATA CATEGORY Products__c AT ' + productcode + ' ' +
			'AND Languages__c AT ' + langcode + ' LIMIT ' + numresults;
	  
	List<List<SObject>> qry = search.query(query);

	system.debug('\n\nSearch results: ' + qry + '\n\n');
	return qry;	
}

 

 

So if I pass in keyword as 'guide', productcode as 'lmirescue', lang as 'en', and numresults as 5, I get results on both FAQ__kav and Documentation__kav, but not Link__kav.  If I submit the same search via the Articles tab itself, filtering by the data categories, I get the expected search results.

 

The only difference in the structure is that Link__kav has no rich text fields.  It's simple a couple of text fields for Title (default), Localized_Title__c (text, 255), Url (Text, 255).

 

My question is, why would SOSL not pick up articles by the text fields defined for the article type if I'm using the IN ALL FIELDS syntax?  Should at least the default Title field be indexed?  Isn't SOSL supposed to be the same underlying search engine as the actual user interface?  Am I going batty?

Hi,
 
Is there a way to programatically use the letterhead in sendmail api.
I cannot use the template as the email contains references to  multiple objects and have to create the email in my apex code.
 
I still need to retrieve the letterhead specified in an email template and use that programatically to send the mail.
 
 
 
thanks,
Rohit