• Abby Stocker
  • NEWBIE
  • 60 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 27
    Replies
Hello! We have custom email functionality built for a custom object, "Delivery Exceptions". This email functionality replicates that of email to case as in you send an email out with the exception reference number and the replies will attach to the approriate record and each has an email message related list to store them. I have an ask that these emails ALSO come into the exception chatter feed just like they do for email to case. Here is what the emails look like now in the chatter feed:
User-added imageHere is what they look like in Case:
User-added imageHow can I make fix the code to accomplish this? They also want the ability to reply/forward from the chatter post as well like you can with email to case. Any help is GREATLY appreciated. Thank you! 

Here is the code as it stands:

global class DeliveryEmailHandler implements Messaging.InboundEmailHandler {
    
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
        Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
        try{
            id deliveryexceptionId;
            string emailBody = email.plainTextBody;        
            string deliveryexceptionName ='';
            string emailSubject= email.subject;
            system.debug('email subject'+emailSubject);
            pattern regEx = Pattern.compile('(E[0-9]{8})');
            matcher deliveryexceptionMatcherSubject = regEx.matcher(emailSubject);
            //deliveryexceptionMatcherSubject.find();
            if(deliveryexceptionMatcherSubject.find() && deliveryexceptionMatcherSubject.group(1) != null){
                deliveryexceptionName = deliveryexceptionMatcherSubject.group(1);
                system.debug('Delivery Exception name found in subject');
            } else {
                // try body of email if not in subject
                matcher deliveryexceptionMatcherBody = regEx.matcher(emailBody);
                //deliveryexceptionMatcherBody.find();
                if(deliveryexceptionMatcherBody.find() && deliveryexceptionMatcherBody.group(1) != null){
                    deliveryexceptionName = deliveryexceptionMatcherBody.group(1);
                    system.debug('Delivery Exception name found in body');
                } 
            }
            // if matcher matches find delivery exception record
            If (deliveryexceptionName != ''){
                list<Delivery_Exception__c> deliveryexceptionList = [select id,name,account__c from Delivery_Exception__c where name = :deliveryexceptionName];
                if(!deliveryexceptionList.isEmpty() && deliveryexceptionList.size() == 1){
                    deliveryexceptionId = deliveryexceptionList[0].id;
                }
            }
            // attach to error delivery exception if no delivery exception record is found
            if(deliveryexceptionId == null){
                deliveryexceptionId = [select id from Delivery_Exception__c where external_id__c = 'ERROR' limit 1].Id;
            }
            EmailMessage cEmailMessage = new EmailMessage();
            cEmailMessage.ToAddress =  String.join(email.toAddresses, ',');
            cEmailMessage.FromAddress = email.FromAddress;
            cEmailMessage.FromName = email.FromName;
            cEmailMessage.Subject = email.subject;
            cEmailMessage.status = '0';
            cEmailMessage.HtmlBody = email.htmlBody;
            //System.debug('htmlBody:>>>> ' + email.htmlBody );
            cEmailMessage.Incoming= True;
            cEmailMessage.TextBody = email.plainTextBody;
            cEmailMessage.relatedToId = deliveryexceptionId;
            cEmailMessage.Delivery_Exception__c = deliveryexceptionId;
            //cEmailMessage.validatedFromAddress = 'deliverytest@Arhaus.com';
            //System.debug('TextBody:>>>>> ' + email.plainTextBody);
            insert cEmailMessage;
            FeedItem item = new FeedItem();
            item.parentId = cEmailMessage.relatedToId = deliveryexceptionId;
            item.Body = cEmailMessage.relatedToId = deliveryexceptionId;
            insert item;
            System.debug('Reply Email: ' + cEmailMessage ); 
            //Add Email Message Relation the from address
            list<emailMessageRelation> emailMessageRelations = new list<emailMessageRelation>();
            emailMessageRelations.add(new EmailMessageRelation(
                EmailMessageId = cEmailMessage.id,
                RelationAddress = email.FromAddress,
                RelationType = 'FromAddress'));
            // as of 10-24-19 Salesforce required a relationship to be able to reply.
            // this code section can be removed when Salesforce support Org Wide Email Addresses to be used on custom objects
            // with the functionality supported on the case object.
            // 
            for(user u : [select id,email from user where Exception_Email_Functionality__c = true and isactive = true]){
                emailMessageRelations.add(new EmailMessageRelation(EmailMessageId = cEmailMessage.id, RelationId = u.id, RelationType = 'BccAddress'));    
            }
            insert emailMessageRelations;
            // if email attachments are not null create files
            if(email.binaryAttachments != null) createContentDocumentLinks(email.binaryAttachments, cEmailMessage.id, deliveryexceptionId);
        } catch(exception e){
            system.debug('exception processing delivery exception inbound email:'+e.getMessage());
        }
        result.success = true;
        return result;
    }
    public boolean createContentDocumentLinks(Messaging.InboundEmail.BinaryAttachment[] binAttachList, Id insertedEmailMessageId, Id deliveryexceptionId) {
        List<ContentVersion>cvList = new List<ContentVersion>();
        List<ContentDocumentLink> cdlList = new List<ContentDocumentLink>();
        for (Messaging.InboundEmail.BinaryAttachment binAttach : binAttachList) {
            ContentVersion testContentInsert = new ContentVersion();
            testContentInsert.Title = binAttach.fileName;
            testContentInsert.VersionData = binAttach.body;
            testContentInsert.PathOnClient = '/' + binAttach.fileName ;
            cvList.add(testContentInsert);
            
        }
        insert cvList;
        cvList = [select id, ContentDocumentId from ContentVersion WHERE Id in :cvList];
        for (ContentVersion cv : cvList) {
            ContentDocumentLink cl = new ContentDocumentLink();
            cl.ContentDocumentId = cv.ContentDocumentId;
            cl.LinkedEntityId = insertedEmailMessageId;
            cl.ShareType = 'V';
            cl.Visibility = 'AllUsers';
            cdlList.add(cl);
            // add link to delivery exception also
            ContentDocumentLink clc = new ContentDocumentLink();
            clc.ContentDocumentId = cv.ContentDocumentId;
            clc.LinkedEntityId = deliveryexceptionId;
            clc.ShareType = 'V';
            clc.Visibility = 'AllUsers';
            cdlList.add(clc);
        }
        insert cdlList;
        return true;
    }
}
Hello! We have created custom email functionality on a custom object that acts almost exactly like email to case. The problem I am facing is that the email comes in and connects to the correct Delivery Exception record (custom object) but doesnt create a feed item like email to case does. The users would like to see the emails in the chatter feed of the record as well as the email message related list (email message related list is created) would the code look something like the following (I am still in the beginning stages of learning to code)?
{
FeedItem item = new Feeditem();
FeedItem post = new FeedItem();
post.ParentId = deliveryexceptionId;
post.Body = email.plainTextBody;
Insert Post;
}

Here is the class as it stands now:

global class DeliveryEmailHandler implements Messaging.InboundEmailHandler {
    
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
        Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
        try{
            id deliveryexceptionId;
            string emailBody = email.plainTextBody;        
            string deliveryexceptionName ='';
            string emailSubject= email.subject;
            system.debug('email subject'+emailSubject);
            pattern regEx = Pattern.compile('(E[0-9]{8})');
            matcher deliveryexceptionMatcherSubject = regEx.matcher(emailSubject);
            //deliveryexceptionMatcherSubject.find();
            if(deliveryexceptionMatcherSubject.find() && deliveryexceptionMatcherSubject.group(1) != null){
                deliveryexceptionName = deliveryexceptionMatcherSubject.group(1);
                system.debug('Delivery Exception name found in subject');
            } else {
                // try body of email if not in subject
                matcher deliveryexceptionMatcherBody = regEx.matcher(emailBody);
                //deliveryexceptionMatcherBody.find();
                if(deliveryexceptionMatcherBody.find() && deliveryexceptionMatcherBody.group(1) != null){
                    deliveryexceptionName = deliveryexceptionMatcherBody.group(1);
                    system.debug('Delivery Exception name found in body');
                } 
            }
            // if matcher matches find delivery exception record
            If (deliveryexceptionName != ''){
                list<Delivery_Exception__c> deliveryexceptionList = [select id,name,account__c from Delivery_Exception__c where name = :deliveryexceptionName];
                if(!deliveryexceptionList.isEmpty() && deliveryexceptionList.size() == 1){
                    deliveryexceptionId = deliveryexceptionList[0].id;
                }
            }
            // attach to error delivery exception if no delivery exception record is found
            if(deliveryexceptionId == null){
                deliveryexceptionId = [select id from Delivery_Exception__c where external_id__c = 'ERROR' limit 1].Id;
            }
            EmailMessage cEmailMessage = new EmailMessage();
            cEmailMessage.ToAddress =  String.join(email.toAddresses, ',');
            cEmailMessage.FromAddress = email.FromAddress;
            cEmailMessage.FromName = email.FromName;
            cEmailMessage.Subject = email.subject;
            cEmailMessage.status = '0';
            cEmailMessage.HtmlBody = email.htmlBody;
            //System.debug('htmlBody:>>>> ' + email.htmlBody );
            cEmailMessage.Incoming= True;
            cEmailMessage.TextBody = email.plainTextBody;
            cEmailMessage.relatedToId = deliveryexceptionId;
            cEmailMessage.Delivery_Exception__c = deliveryexceptionId;
            //cEmailMessage.validatedFromAddress = 'deliverytest@Arhaus.com';
            //System.debug('TextBody:>>>>> ' + email.plainTextBody);
            insert cEmailMessage;
            System.debug('Reply Email: ' + cEmailMessage ); 
            //Add Email Message Relation the from address
            list<emailMessageRelation> emailMessageRelations = new list<emailMessageRelation>();
            emailMessageRelations.add(new EmailMessageRelation(
                EmailMessageId = cEmailMessage.id,
                RelationAddress = email.FromAddress,
                RelationType = 'FromAddress'));
            // as of 10-24-19 Salesforce required a relationship to be able to reply.
            // this code section can be removed when Salesforce support Org Wide Email Addresses to be used on custom objects
            // with the functionality supported on the case object.
            // 
            for(user u : [select id,email from user where Exception_Email_Functionality__c = true and isactive = true]){
                emailMessageRelations.add(new EmailMessageRelation(EmailMessageId = cEmailMessage.id, RelationId = u.id, RelationType = 'BccAddress'));    
            }
            insert emailMessageRelations;
            // if email attachments are not null create files
            if(email.binaryAttachments != null) createContentDocumentLinks(email.binaryAttachments, cEmailMessage.id, deliveryexceptionId);
        } catch(exception e){
            system.debug('exception processing delivery exception inbound email:'+e.getMessage());
        }
        result.success = true;
        return result;
    }
    public boolean createContentDocumentLinks(Messaging.InboundEmail.BinaryAttachment[] binAttachList, Id insertedEmailMessageId, Id deliveryexceptionId) {
        List<ContentVersion>cvList = new List<ContentVersion>();
        List<ContentDocumentLink> cdlList = new List<ContentDocumentLink>();
        for (Messaging.InboundEmail.BinaryAttachment binAttach : binAttachList) {
            ContentVersion testContentInsert = new ContentVersion();
            testContentInsert.Title = binAttach.fileName;
            testContentInsert.VersionData = binAttach.body;
            testContentInsert.PathOnClient = '/' + binAttach.fileName ;
            cvList.add(testContentInsert);
            
        }
        insert cvList;
        cvList = [select id, ContentDocumentId from ContentVersion WHERE Id in :cvList];
        for (ContentVersion cv : cvList) {
            ContentDocumentLink cl = new ContentDocumentLink();
            cl.ContentDocumentId = cv.ContentDocumentId;
            cl.LinkedEntityId = insertedEmailMessageId;
            cl.ShareType = 'V';
            cl.Visibility = 'AllUsers';
            cdlList.add(cl);
            // add link to delivery exception also
            ContentDocumentLink clc = new ContentDocumentLink();
            clc.ContentDocumentId = cv.ContentDocumentId;
            clc.LinkedEntityId = deliveryexceptionId;
            clc.ShareType = 'V';
            clc.Visibility = 'AllUsers';
            cdlList.add(clc);
        }
        insert cdlList;
        return true;
    }
}


THANK YOU SO MUCH FOR ANY ASSISTANCE!!!!
Please help with the following error, Thank you so much.
ERROR:
Error while creating component for lightning component quick action [Unable to find action 'PhysicalInventoryClaimPDF' on the controller of c:PhysicalInventoryClaimPDF]

COMPONENT:
<aura:component description="PhysicalInventoryClaimPDF" controller="PhysicalInventoryPDFController" implements="force:lightningQuickAction,force:hasRecordId">

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <aura:attribute name="recordId" type="Id"/>
    <aura:attribute name="documentId" type="Id"/>
    <aura:attribute name="documentCreated" type="Boolean"/>

    <div>
        <lightning:fileCard fileId="{!v.documentId}" description="{!'Loss and Damage Claim Form'}"/>
    </div>
</aura:component>

CONTROLLER:
({
    doInit: function (component, event, helper) {
        helper.getPdfToDownload(component);
    },

    savePdf: function (component, event, helper) {
        console.log('SAVING');
    },
});

HELPER:
({
 
    getPdfToDownload: function (component) {
        var getPdfAction = component.get("c.PhysicalInventoryClaimPDF");
        getPdfAction.setParams({
            claimId: component.get("v.recordId")
        });
        getPdfAction.setCallback(this, function (response) {
            var responseState = response.getState();
            if (responseState === "SUCCESS") {
                component.set("v.documentId", response.getReturnValue());
                component.set("v.documentCreated", true);
            } else {
                alert("Error message: " + JSON.stringify(response.getError()));
            }
        });
        $A.enqueueAction(getPdfAction);
    }
});
Please help with the following error. Thank you! 
User-added imageUser-added image
This is strange and must be something simple. I have a lightning quick action on the Claim custom object that should initiate the download of the "HomeDamage" visualforce page but when you click on the button it takes you to the "deliverynew" visualforce page instead?????? Any help is appreciated. Here is what I have provided below: Screenshot of quick action button, screenshot of quick action settings, screenshot of debug log and then the VF page code. 
THANK YOU! 

User-added image
User-added imageUser-added image<apex:page standardController="Claim__c" renderAs="pdf" standardStylesheets="false" sideBar="false" showHeader="false" applyBodyTag="false">
    <head>
        <title>Claim PDF</title>
        <style type="text/css">
            @page {
                margin-top: 10%;
                margin-bottom: 10%;
                margin-left: 5%;
                margin-right: 5%;
            }
            * {
                font-family: Arial;
            }
            div {
                padding-bottom: 1em;
            }
            table {
                text-align: Left;
                margin-left: auto;
                margin-right: auto;
            }
            th {
                font-weight: bold;
            }
            .arhausTitle {
                
                font-size: 12px;
                line-height: 0px;
                text-align: center;
            }
            .formTitle {
                font-size: 11px;
                text-align: center;
                margin-top: 5%;
            }
            .formFooter {
                position: static;
                bottom: 0;
                font-size: 14px;
                text-align: left;
                align-content: left;
                line-height: 24px;
            }
            .contactColumn {
                width: 50%;
                float: left;
                text-align: left;
            }
            .formBlanks {
                
                margin-left: 10%;
                margin-right: auto;
                margin-top: 5%;
                font-size: 14px;
                empty-cells: hide;
                text-align: left; 
            }
            .formBlanks td {
                width: 37%;
                text-align: left;               
            }
            #emptyCell {
                width: 5%;
                border-bottom: none;
            }
            .formTable * {
                font-size: 11px;
                border: 1px solid black;
                border-collapse: collapse;
                empty-cells: show;
                padding: 5px;
            }
            .formTable th {
                text-transform: uppercase;                
            }
            .formTable td {
                text-transform: none;
            }
            .formtext {
                margin-left: 10%;
                margin-right: 10%;
                font-size: 14px;
                empty-cells: hide;
                text-align: left; 
            }  
              .footer {
                margin-top: 20%;
                margin-left: auto;
                margin-right: auto%;
                font-size: 14px; 
                text-align: left;
                               
            }   
        </style>
    </head>
    <body>
        <div class="arhausTitle">
            <div>
                <apex:image url="{!$Resource.QuoteLogo}" width="300px"/>
                <p>51 E. Hines Hill Rd Boston Heights, OH 44236</p>
                
                <p></p>
                
                <p>Phone: (440) 439-7700 Fax: (440) 449-7073</p>
            </div>
        </div>
      
        <div class="formBlanks">
            <table>
                <tr>
                  <td>Claim #: {!Claim__c.Name}</td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                 <td>Order #: {!Claim__c.Order_Number__r.Name}</td>
                   </tr>  
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                 <td>Client Name: {!Claim__c.Account__r.Name}</td>
                   </tr>  
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td>Date of Failed Delivery:
                        <apex:outputText value="{0, date, MMMM d','  yyyy}">
                            <apex:param value="{!Claim__c.Date_of_Occurence__c}" />
                        </apex:outputText>
                    </td>
                 </tr> 
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                 <td>Carrier: {!Claim__c.Carrier__c}</td>
                 </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                 <td>Hub Location: {!Claim__c.Hub_Location_DC__c}</td>
                                  </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                
                <tr>
                  <td>Delivery Charge:
                        <apex:outputText value="{0, number, ###,##0.00}">
                            $<apex:param value="{!Claim__c.Additional_Delivery_Charge__c}"/>
                        </apex:outputText>
                    </td>
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                  <td></td>                
                </tr>
                <tr>
                 <td>Notes: {!Claim__c.Notes__c}</td>
                                  </tr>
                <div class="footer">
                 Thank you,
                <p>TEXT</p>
                    <p><a style="text-align: left" href="TEXT"> TEXT</a></p>
                  <p>   P: 440.439.7700 x 3226</p>

        </div>
                                                                               
    </table>        
    </div>
    </body>
    </apex:page>
I am a beginner here. I have started to self teach myself Apex and have received great help from this community so I figured I would try again. Here is the request: I have a custom "Claim" object. When an order is selected, a flow takes the user through adding order line items that are related to the selected order. Now I am starting a project for a new type of "Claim" and they want to take this a step further. From the claim record, users should get a flow to take them through the following: Be able to select MULTIPLE orders and then loop through each specific order line for each selected order and relate those to the claim as well. Please let me know if this makes absolutely zero sense. Thank you!!!!!
Hello, Our accounts are brought in from our data warehouse. In there, all account names are written in all uppercase (JOHN SMITH) I created a formula field that makes it proper case for email templates (John Smith). The problem is if someone entered the customer's first name as "JOHN & JANE" their name appears like this, "John & jane Smith" (j in Jane not being capitalized) Is there a way to fix this? Here is the code as it stands:

UPPER(MID(Order_Number__r.AccountId__r.FirstName, 1, 1))&LOWER( MID(Order_Number__r.AccountId__r.FirstName, 2,255)) &" "& UPPER(MID( Order_Number__r.AccountId__r.LastName, 1, 1))&LOWER( MID(Order_Number__r.AccountId__r.LastName, 2,255))

Thank you for any assistance! 
I have tried and tried but I keep getting a ton of errors so I am reaching out to you all for help again! I need to write a trigger that will not allow a user to create a task on a case when the case status is "closed". Thank you!!!!
What would I do without the community!? 
Please assist with the error for the trigger. Thank you! 

CLASS------->
public class RelatedTasks { 
    public static boolean taskmethod(){
        List<Task> tasks = [SELECT id, status from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id') and status = 'Open'];
        boolean isOpen = false;
        for(Task t : tasks){        
            if(t.Status =='Open'){
                isOpen = true;           
            }
        } 
        return isOpen;
    }
}


TRIGGER------------>
trigger getOpenTasks on Case (before update) {
    for(Case c : Trigger.New){        
        If(RelatedTasks.taskmethod().isOpen==true){
            c.adderror('You cannot close a case with an open task');
        }
    }
}
ERROR---------> Variable does not exist: isOpen

THANK YOU!!!
Hello! Can someone help me figure out what is wrong with my Apex class? Thank you! 
public class RelatedTasks { 
    
    Public static void taskmethod(){List<Task> tasks = [SELECT id, status from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id') and status = 'Open'];}
  
    for(Task t : tasks){        
        If(t.Status =='Open'){
            boolean isOpen = true;           
        }
        return isOpen;
    }                    
    }

and the error is the following:
Expecting '}' but was: 'for'


Thank you! 
I have received some pretty awesome help from here correcting my code so I figured I would try to see if anyone can help me write a test class. My training (newbie) on test classes so far only include validating if statements, creating accounts with field values populated etc.. Help! Thank you!!! The 2 classes are for this purpose : Code 1 is looking for the id of the current case record. Code 2 is looking for the task id's associated with that current case record. 
Code 1
public class currentCaseRecord {
        Case currentRecord;
    public currentCaseRecord (ApexPages.StandardController controller){
        currentRecord = [Select Id FROM Case Where Id =:ApexPages.CurrentPage().getparameters().get('id')];
        }
    public case getcurrentRecord(){
        return currentRecord;
    }
}

Code 2
public class RelatedTasks {                
    List<Task> tasks = [SELECT id, subject from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id')];                             
    }
Hello! I have created an apex class (below) that will get the current case Id. Now I need another class on Task that will get all tasks related to that current case record and store them in something (a list?). That way, I can use both of those apex classes in a trigger. Any idea on how to write the class on Task (get a list of all tasks related to the current case record Id)? I know i need to use Id and Whatid but I am just not sure how to format it out. Thank you!!! (getcurrentrecord code below).
public class currentCaseRecord {
        Case currentRecord;
    public currentCaseRecord (ApexPages.StandardController controller){
        currentRecord = [Select Id FROM Case Where Id =:ApexPages.CurrentPage().getparameters().get('id')];
        }
    public case getcurrentRecord(){
        return currentRecord;
    }
}
I am trying to get the current case record Id. I will be using this class in a trigger. Thank you!!!

public class currentCaseRecord {
    Case currentRecord;
    public currentCaseRecord (Apex Pages.StandardController controller){
        currentRecord = [Select Id FROM Case Where Id =:ApexPages.currentPage().
                getParameters().get('id')];
        }
    public case getcurrentRecord(){
        return currentRecord;
    }
}


Here are the errors I am receiving:
1) Unexpected token '.'.
2)Invalid character in identifier: Pages.StandardController
3)Invalid type: Apex
Hello! I have looked online for this and found 2 answers but neither truly make sense to me as to what the triggers are actually doing. I was wondering if someone could help me accomplish and understand an apex trigger. The requirement is that a case cannot be closed if it has an associated task that is still open. Thank you!!!!
I am having a lot of trouble making my visualforce page a lightning component action on my custom object. Any help is greatly appreciated! My visualforce page is called DeliveryNew
​​​​​​​User-added image
User-added image


























 
Hello! I am just starting out on the development side of SF. We had a company relate email messages with a custom object "claim" so that we were able to route incoming emails back to its associated claim (just like email to case). On the email message object, there is a "Incoming" checkbox field. I would like a "Email Received" checkbox to be put on the claim custom object so I can use it in a flow. The use for it in the flow is as follows: If the "Email Recieved" checkbox is true, DO NOT send email. Any help on how to relate those two checkboxes would be extremely appreciated!! Thank you!!
Hello! I have a request that I need a little assistance with. There are three emails in this string that will be sent out and they need to go out as follows-
EMAIL 1: Sent out on claim creation (Process created already via process builder.
EMAIL 2: Goes out automatically 24 hours after the claim was created (I will add this to the existing process builder)
EMAIL 3: Goes out 48 hours after the claim is created but CANNOT go out if any type of response has been made back to the case by the customer (HELP!). 

How do I add in the logic that the third email does NOT go out if any response from the customer has come in? Thank you! 

 
Please help with the following error. Thank you! 
User-added imageUser-added image
I am a beginner here. I have started to self teach myself Apex and have received great help from this community so I figured I would try again. Here is the request: I have a custom "Claim" object. When an order is selected, a flow takes the user through adding order line items that are related to the selected order. Now I am starting a project for a new type of "Claim" and they want to take this a step further. From the claim record, users should get a flow to take them through the following: Be able to select MULTIPLE orders and then loop through each specific order line for each selected order and relate those to the claim as well. Please let me know if this makes absolutely zero sense. Thank you!!!!!
Hello, Our accounts are brought in from our data warehouse. In there, all account names are written in all uppercase (JOHN SMITH) I created a formula field that makes it proper case for email templates (John Smith). The problem is if someone entered the customer's first name as "JOHN & JANE" their name appears like this, "John & jane Smith" (j in Jane not being capitalized) Is there a way to fix this? Here is the code as it stands:

UPPER(MID(Order_Number__r.AccountId__r.FirstName, 1, 1))&LOWER( MID(Order_Number__r.AccountId__r.FirstName, 2,255)) &" "& UPPER(MID( Order_Number__r.AccountId__r.LastName, 1, 1))&LOWER( MID(Order_Number__r.AccountId__r.LastName, 2,255))

Thank you for any assistance! 
I have tried and tried but I keep getting a ton of errors so I am reaching out to you all for help again! I need to write a trigger that will not allow a user to create a task on a case when the case status is "closed". Thank you!!!!
What would I do without the community!? 
Please assist with the error for the trigger. Thank you! 

CLASS------->
public class RelatedTasks { 
    public static boolean taskmethod(){
        List<Task> tasks = [SELECT id, status from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id') and status = 'Open'];
        boolean isOpen = false;
        for(Task t : tasks){        
            if(t.Status =='Open'){
                isOpen = true;           
            }
        } 
        return isOpen;
    }
}


TRIGGER------------>
trigger getOpenTasks on Case (before update) {
    for(Case c : Trigger.New){        
        If(RelatedTasks.taskmethod().isOpen==true){
            c.adderror('You cannot close a case with an open task');
        }
    }
}
ERROR---------> Variable does not exist: isOpen

THANK YOU!!!
Hello! Can someone help me figure out what is wrong with my Apex class? Thank you! 
public class RelatedTasks { 
    
    Public static void taskmethod(){List<Task> tasks = [SELECT id, status from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id') and status = 'Open'];}
  
    for(Task t : tasks){        
        If(t.Status =='Open'){
            boolean isOpen = true;           
        }
        return isOpen;
    }                    
    }

and the error is the following:
Expecting '}' but was: 'for'


Thank you! 
I have received some pretty awesome help from here correcting my code so I figured I would try to see if anyone can help me write a test class. My training (newbie) on test classes so far only include validating if statements, creating accounts with field values populated etc.. Help! Thank you!!! The 2 classes are for this purpose : Code 1 is looking for the id of the current case record. Code 2 is looking for the task id's associated with that current case record. 
Code 1
public class currentCaseRecord {
        Case currentRecord;
    public currentCaseRecord (ApexPages.StandardController controller){
        currentRecord = [Select Id FROM Case Where Id =:ApexPages.CurrentPage().getparameters().get('id')];
        }
    public case getcurrentRecord(){
        return currentRecord;
    }
}

Code 2
public class RelatedTasks {                
    List<Task> tasks = [SELECT id, subject from Task WHERE WhatId =:ApexPages.CurrentPage().getparameters().get('id')];                             
    }
Hello! I have created an apex class (below) that will get the current case Id. Now I need another class on Task that will get all tasks related to that current case record and store them in something (a list?). That way, I can use both of those apex classes in a trigger. Any idea on how to write the class on Task (get a list of all tasks related to the current case record Id)? I know i need to use Id and Whatid but I am just not sure how to format it out. Thank you!!! (getcurrentrecord code below).
public class currentCaseRecord {
        Case currentRecord;
    public currentCaseRecord (ApexPages.StandardController controller){
        currentRecord = [Select Id FROM Case Where Id =:ApexPages.CurrentPage().getparameters().get('id')];
        }
    public case getcurrentRecord(){
        return currentRecord;
    }
}