You need to sign in to do that
Don't have an account?
Inserting another public static void in an Apex Class?
How can I insert this public static void in my existing Apex Class and include the Case Thread Id in the email?
To insert:
public static String ThreadId(String caseid) { string Case_ThreadID = '_' + UserInfo.getOrganizationId().left(4) + '0' ; Case_ThreadID = Case_ThreadID + UserInfo.getOrganizationId().mid(11,4) + '._'; Case_ThreadID = Case_ThreadID + caseid.left(4) + '0' + caseId.mid(10,5); return Case_ThreadID; }
My existing Apex Class:
// Sends Case information to the Interpreting Department // Email addresses are listed under Custom Labels: custom_VIEmailAddresses public class custom_VICasesForwarding { @InvocableMethod(Label='forwardToInterpretingDept') public static void forwardToInterpretingDept(List<ID> caseRecords){ Set<Id> createEmailAddresses = new Set<Id>(); List<Case> caseList = [select Id, Subject, CaseNumber, Case_Reason__c, Case_Issue__c, Description, Date_Time_of_Call__c, VINumber__c, Customer_s_VP__c, Outbound_Audio__c, (select Id from EmailMessages) from Case where Id IN :caseRecords]; for(Case c: caseList){ // Pulls field data from Case to include in the email body Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); String[] toaddr = new String[System.Label.custom_VIEmailAddresses.split(',')]; string[] ccaddr = new string[]{}; email.setSubject('FW: ' + c.CaseNumber + ' : ' + c.Case_Reason__c); email.setHtmlBody('Case Number: ' + c.CaseNumber + '<br/>' + 'Case Reason: ' + c.Case_Reason__c + '<br/>' + 'Case Issue: ' + c.Case_Issue__c + '<br/>' + + '<br/>' + 'Date/Time: ' + c.Date_Time_of_Call__c + '<br/>' + 'VI #: ' + c.VINumber__c + '<br/>' + 'Customer\'s VP #: ' + c.Customer_s_VP__c + '<br/>' + 'Outbound Audio #: ' + c.Outbound_Audio__c + '<br/>' + + '<br/>' + + '<br/>' + 'Case Description: ' + c.Description + '<br/>' + + '<br/>' + + '<br/>' + '<i>' + '*Note: If there are any null values, this means this information was not provided by the Case Owner prior to this submission.' + '<i>' + '<br/>'); email.setToAddresses(toaddr); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); } Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); } }
All Answers
Good idea! Did not think of that. How do I get that as a custom field? Formula field and just put in the formula: