• Anshul Agrawal 27
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Salesforce Lead
  • Lirik Inc


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hi,

I have made a custom email publisher on case and based on Record Type, i am populating different email address from Custom Labels in fromEmailAddress. I want to display a friendly name. 
Say insted of test@test.com <test@test.com> to Test <test@test.com>

Email Publisher
I am able to interact and send the email on Case.Email using template Id and using canvas
Sfdc.canvas.publisher.publish({name: 'publisher.selectAction', 
        payload: { actionName: 'Case.Email'}}); 
        Sfdc.canvas.publisher.publish({name: 'publisher.setActionInputValues', 
        payload: {
               actionName: 'Case.Email',
               emailFields: {
                template: {id: id}, 
            }
               //emailTemplate:{id:id}
        }});

However, i want to also interact with Custom Quick Email Action(apex:emailPublisher). We do get a option to select a template in the Custom action. But i want to pass the template from a custom console component. I tried a remote call to controller to set the emailbody. But couldn't find a way to rerender and update the email body just like it works when we select the template already available on email action. Any help/direction is appreciated on how can i pass templates to custom email action. Thanks

 
I am able to interact and send the email on Case.Email using template Id and using canvas
Sfdc.canvas.publisher.publish({name: 'publisher.selectAction', 
        payload: { actionName: 'Case.Email'}}); 
        Sfdc.canvas.publisher.publish({name: 'publisher.setActionInputValues', 
        payload: {
               actionName: 'Case.Email',
               emailFields: {
                template: {id: id}, 
            }
               //emailTemplate:{id:id}
        }});

However, i want to also interact with Custom Quick Email Action(apex:emailPublisher). We do get a option to select a template in the Custom action. But i want to pass the template from a custom console component. I tried a remote call to controller to set the emailbody. But couldn't find a way to rerender and update the email body just like it works when we select the template already available on email action. Any help/direction is appreciated on how can i pass templates to custom email action. Thanks

 
Hi I am new to Apex and would like to ask some direction here.

What's the code to put if I want to use apex:emailPublisher to set the fromAddresses based on the Case Origin?

For example:
  1. sales@company.com; Case Origin is Sales Inquiry
  2. support@company.com; Case Origin is Customer Support
  3. orders@company.com; Case Origin is Order Inquiry
User-added image
In order to send an email with a predefined email template (from the case feed email action), I am using this code (based on the example in p.29 in https://resources.docs.salesforce.com/sfdc/pdf/case_feed_dev_guide.pdf):
function emailSolution(content) {   
    Sfdc.canvas.publisher.publish({name: 'publisher.selectAction', 
    payload: { actionName: 'Case.Email'}}); 
    Sfdc.canvas.publisher.publish({name: 'publisher.setActionInputValues', 
    payload: {
       actionName: 'Case.Email',
       emailFields: {
            template: 'folderName/templateName', 
            body: { value:content, format:'richtext', insert: true}
       }
}});

However, the template parameter has no effect on the email (the email body contains only the string 'content'). If the body parameter is omitted, the email body is empty. I couldn't find any example for usage of the template parameter in the online documentation, has anyone tried already to use it and can provide a code sample?
  • August 26, 2015
  • Like
  • 0