• Niels Petiet
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I'm struggling with the custom lightning component on this part. I don't have much background coding and am having trouble finding resources to help me achieve coding the lightning component. If someone could help give me some framework code to create a custom lightning component to hold a URL or direct me to a resource that help break this down I'd be very appreciative.
 

Hello,

 

I have some custom code written that is used to 'help' email to case.  Basically, what happens is that if an email is received for an already "Closed" case (via email-to-case) a trigger on the EmailMessage object does some evaluations and then creates a NEW child case and then creates a clone of the original EmailMessage and relates it to the new case.  I would simply just change the case the original emailMessage is related to, but we don't have access to change the ParentID field on the emailmessage record.

 

My issue is in getting the ATTACHMENTS to the orignal email and relating them to the new email.  When I query in my class for the attachments it returns 0 rows when testing and I KNOW there is an attachment on the email (the original emailMessage shows an attachment as well).  Is this because I am triggering on insert of the EmailMessage record, meaning that the attachment records have not yet been inserted?

 

If that IS the case is there any way I can get these attachments and related them to the correct cloned email at their insertion?  I just don't see how I will be able to hold the ID(s) needed in memory between the two separate DML operations that are happening (insertion of the original Email and then insertion of the Attachments)

 

Any help/ideas would be appreciated.