Search Here

apex: emailPublisher Component in Visualforce Page

 The <apex: emailPublisher> component allows support agents to compose and send email messages to the customers using the Case Feed. In order to support email templates and attachments, we can customize this publisher. This component can only be used in organizations with Case Feed, and Email-to-Case enabled.


The <apex: emailPublisher> component has the following attributes:


1. autoCollapseBody


The autoCollapseBody is a Boolean-type attribute used to specify whether the email body will be collapsed to a small height when it's empty.


Syntax:


<apex:emailPublisher autoCollapseBody="false"></apex:emailPublisher>  

2. bccVisibility


The bccVisibility is a string-type attribute used to specify the visibility of the BCC field. These are the possible values for this attribute:


editable

editableWithLookup

readOnly

hidden

Syntax:


<apex:emailPublisher bccVisibility="editable"></apex:emailPublisher>  

3. ccVisibility


The ccVisibility is a string-type attribute that specifies the CC field's visibility. These are the possible values for this attribute:


editable

editableWithLookup

readOnly

hidden

Syntax:


<apex:emailPublisher ccVisibility="editable"></apex:emailPublisher>  

4. emailBody


The emailBody is a string-type attribute that specifies the email body's default text value.


Syntax:


<apex:emailPublisher emailBody="Default Text"></apex:emailPublisher>  

5. emailBodyFormat


The emailBodyFormat is a string-type attribute that specifies the email body's format. These are the possible values for this attribute:


text

HTML

textAndHTML

Syntax:

AD


<apex:emailPublisher emailBody="Default Text"></apex:emailPublisher>  

6. emailBodyHeight


The emailBodyHeight is a string-type attribute that specifies the email body's height in em.


Syntax:


<apex:emailPublisher emailBodyHeight="height in em"></apex:emailPublisher>  

7. enableQuickText


The enableQuickText is a Boolean-type attribute used to specify whether the quick text autocomplete functionality will be available in the publisher.

AD


Syntax:


<apex:emailPublisher enableQuicktext="true"></apex:emailPublisher>  

8. entityId


The entityId is an Id-type attribute used to specify the entity id of the record for displaying the email publisher.


Syntax:


<apex:emailPublisher entityId="Entity Id"></apex:emailPublisher>  

9. expandableHeader


The expandableHeader is a Boolean-type attribute used for specifying whether the header is expandable or fixed.


Syntax:


<apex:emailPublisher expandableHeader="true"></apex:emailPublisher>  

10. fromAddresses


The fromAddresses is a string-type attribute used for specifying the restricted set of from addresses.


Syntax:


<apex:emailPublisher fromAddresses="set of from addresses"></apex:emailPublisher>  

11. fromVisibility


The fromVisibility is a string-type attribute used for specifying the visibility of the "From" field. These are the possible values for this attribute:


selectable

hidden

Syntax:


<apex:emailPublisher fromVisibility="selectable"></apex:emailPublisher>  

12. id


The id is a string-type attribute, i.e., a unique identifier that allows this component to be referenced by other components on the page.


Syntax:


<apex:emailPublisher id="publisherId"></apex:emailPublisher>  

13. onSubmitFailure


The onSubmitFailure is a string-type attribute used for specifying the JavaScript method invoked when the email failed to be sent.


Syntax:


<apex:emailPublisher onSubmitFailure="handleFailure();"></apex:emailPublisher>  

14. onSubmitSuccess


The onSubmitFailure is a string-type attribute that specifies the JavaScript method invoked when the email was successfully sent.


Syntax:


<apex:emailPublisher onSubmitSuccess="handleSuccess();"></apex:emailPublisher>  

15. rendered


The rendered is a Boolean-type attribute used to specify whether the component is rendered on the page. The boolean value true is set as a default value for this attribute.


Syntax:


<apex:emailPublisher rendered="true"></apex:emailPublisher>  

16. reRender


The reRender is an Object-type attribute used for specifying the Ids of one or more components that need to be redrawn when the email is sent successfully.


Syntax:


<apex:emailPublisher reRender="Id1, Id2, Id3, ..."></apex:emailPublisher>  

17. sendButtonName


The sendButtonName is a string-type attribute used for specifying the name of the send button in the email publisher.


Syntax:


<apex:emailPublisher sendButtonName="Button Name"></apex:emailPublisher>  

18. showAdditionalFields


The showAdditionalFields is a Boolean-type attribute used to specify whether the additional fields defined in the publisher layout should be displayed.


Syntax:


<apex:emailPublisher showAdditionalFields="false"></apex:emailPublisher>  

19. showAttachments


The showAttachments is a Boolean-type attribute used to specify whether the attachment selector should be displayed.


Syntax:


<apex:emailPublisher showAttachments="false"></apex:emailPublisher>  

showSendButton


The showSendButton is a Boolean-type attribute that specifies whether the send button should be displayed.


Syntax:


<apex:emailPublisher showSendButton="false"></apex:emailPublisher>  

21. showTemplates


The showTemplates is a Boolean-type attribute used to specify whether the template selector should be displayed.


Syntax:


<apex:emailPublisher showtemplates="false"></apex:emailPublisher>  

22. subject


The subject is a string-type attribute used for specifying the default value of the subject.


Syntax:


<apex:emailPublisher subject="subject text"></apex:emailPublisher>  

23. subjectVisibility


The subjectVisibility is a string-type attribute that is used for specifying the visibility of the Subject field. These are the possible values for this attribute:


editable

readOnly

hidden

Syntax:


<apex:emailPublisher subjectVisibility="editable"></apex:emailPublisher>  

24. submitFunctionName


The submitFunctionName is a string-type attribute that is used for specifying the name of the function called from JavaScript to send the email


Syntax:


<apex:emailPublisher submitFunctionName="functionName"></apex:emailPublisher>  

25. title


The title is a string-type attribute used to specify the title displayed on the email publisher header.


Syntax:


<apex:emailPublisher title="Publisher Title"></apex:emailPublisher>  

26. toAddresses


The toAddresses is a string-type attribute used to specify the default value of the "To" field.


Syntax:


<apex:emailPublisher toAddresses="To Addresses"></apex:emailPublisher>  

27. toVisibility


The toVisibility is a string-type attribute used for specifying the visibility of the "To" field. These are the possible values for this attribute:


editable

editableWithLookup

readOnly

hidden

Syntax:


<apex:emailPublisher ccVisibility="editable"></apex:emailPublisher>  

28. verticalResize


The verticalResize is a Boolean-type attribute used to specify whether the publisher allows vertical resizing.


Syntax:


<apex:emailPublisher verticalResize="true"></apex:emailPublisher>  

29. width


The width is a string-type attribute used to specify the publisher's width in pixels or in percentages.


Syntax:


<apex:emailPublisher width="250px"></apex:emailPublisher></p>  

<p>Let's take an example to understand how we can use this component on the VF page:</p>  

<p><strong>ApexEmailPublisherExample.vfp</strong></p>  

<div class="codeblock"><textarea name="code" class="xml">  

<apex: page standardController="Case" showHeader="true" >  

    <apex: emailPublisher id="publisherId"   

                         entityId="{!case.id}"   

                         width="700px"  

                         title="Send an Email to Case"  

                         expandableHeader="false"  

                         autoCollapseBody="false"  

                         showAdditionalFields="false"  

                         fromVisibility="selectable"  

                         toVisibility="editable"  

                         bccVisibility="hidden"   

                         ccVisibility="hidden"  

                         emailBody=""  

                         subject="Reminder Case"  

                         toAddresses=""  

                         onSubmitFailure="alert('failed');"  

                         fromAddresses="test1@gmail.com,test2@gmail.com"/>    

</apex: page>  

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.