• cekoge hrean
  • NEWBIE
  • 0 Points
  • Member since 2022

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

I have some apex code that looks like the code below. In my test class, I have a testMethod for successful execution, but I'm having trouble creating a testMethod for the exception. I've been able to trigger the exception, but the test is marked as Fail and I recieve "System.AuraHandledException: Script-thrown exception". As a result, I'm not getting code coverage for this exception.

How can I successfully test an AuraHandledException from a testMethod without breaking the test and having it result in a Fail?
try{
   update account;
}
catch(Exception e){
   throw new AuraHandledException('error updating account');
}

 

I think I've already checked with most of the email template discussions but really haven't found if this can be done.

 

Scenario:

John is in Service Cloud and is answering a customer through case email. He fills out all the necessary field (From, To, Subject, and Body) and selects a custom HTML/CSS email template.

Now, instead of clicking the button "Send Email", i would create buttons that said "Preview in HTML or "Preview in Text"  so the John can preview all the fields that he filled out into my custom HTML/CSS email template. Preview window with the "Send Button"

 

Reasons:

Branded email templates throughout org

 

Before diving into trying to develop this, can anyone tell me if this can be done or not? My thinking is yes and sounds simple. But i think the part of the action triggerring of the new buttons and possibly calling out the new fields to transfer the info to the custom HTML/CSS email template can somewhat be difficult. And not knowing what other hang ups I will face.

 

I appreicate the feedbacks. Thanks

-J

 

  • November 07, 2013
  • Like
  • 2