Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EU/feature1 #15

Open
wants to merge 1 commit into
base: Int
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions uk/force-app/main/default/classes/CaseHoldingEmailHandler.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
global class CaseHoldingEmailHandler {
@InvocableMethod(label='Send Holding Email' description='Sends a holding email when a case is opened.')
public static void sendHoldingEmail(List<Id> caseIds) {
if (caseIds == null || caseIds.isEmpty()) {
return;
}

List<Case> caseList = [SELECT Id, ContactEmail FROM Case WHERE Id IN :caseIds];
List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();

for (Case c : caseList) {
if (c.ContactEmail != null) {
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setToAddresses(new List<String>{c.ContactEmail});
email.setSubject('We Have Received Your Case');
email.setPlainTextBody('Thank you for contacting us. We have received your case and are working on it. We will keep you updated with any progress.');
emails.add(email);
}
}

if (!emails.isEmpty()) {
Messaging.sendEmail(emails);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>62.0</apiVersion>
<status>Active</status>
</ApexClass>
272 changes: 272 additions & 0 deletions uk/force-app/main/default/flows/Update_Cases_To_Closed.flow-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<actionCalls>
<name>Notify_DevOps_Team</name>
<label>Notify DevOps Team</label>
<locationX>1050</locationX>
<locationY>632</locationY>
<actionName>emailSimple</actionName>
<actionType>emailSimple</actionType>
<flowTransactionModel>CurrentTransaction</flowTransactionModel>
<inputParameters>
<name>emailAddresses</name>
<value>
<elementReference>$User.Email</elementReference>
</value>
</inputParameters>
<inputParameters>
<name>emailSubject</name>
<value>
<stringValue></stringValue>
</value>
</inputParameters>
<inputParameters>
<name>emailBody</name>
<value>
<elementReference>Laurence</elementReference>
</value>
</inputParameters>
<inputParameters>
<name>ccRecipientAddressList</name>
</inputParameters>
<nameSegment>emailSimple</nameSegment>
<versionSegment>1</versionSegment>
</actionCalls>
<actionCalls>
<name>Send_Holding_Email</name>
<label>Send Holding Email</label>
<locationX>532</locationX>
<locationY>638</locationY>
<actionName>CaseHoldingEmailHandler</actionName>
<actionType>apex</actionType>
<flowTransactionModel>CurrentTransaction</flowTransactionModel>
<nameSegment>CaseHoldingEmailHandler</nameSegment>
<versionSegment>1</versionSegment>
</actionCalls>
<apiVersion>60.0</apiVersion>
<assignments>
<name>Assign_to_T3_Support</name>
<label>Assign to High</label>
<locationX>108</locationX>
<locationY>358</locationY>
<assignmentItems>
<assignToReference>$Record.OwnerId</assignToReference>
<operator>Assign</operator>
<value>
<elementReference>Laurence</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Check_Service_Eligibility</targetReference>
</connector>
</assignments>
<decisions>
<description>If the Status is Open, after 3 days auto-close.</description>
<name>DecisionIfCaseIsClosed</name>
<label>DecisionIfCaseIsClosed</label>
<locationX>823</locationX>
<locationY>348</locationY>
<defaultConnector>
<targetReference>Ready_to_Archive</targetReference>
</defaultConnector>
<defaultConnectorLabel>Status is Closed</defaultConnectorLabel>
<rules>
<name>StatusIsntClosed</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>$Record.Status</leftValueReference>
<operator>NotEqualTo</operator>
<rightValue>
<stringValue>Closed</stringValue>
</rightValue>
</conditions>
<conditions>
<leftValueReference>LastModifiedDate</leftValueReference>
<operator>GreaterThan</operator>
<rightValue>
<numberValue>90.0</numberValue>
</rightValue>
</conditions>
<connector>
<targetReference>UpdateToClosed</targetReference>
</connector>
<label>StatusIsn&apos;tClosed</label>
</rules>
</decisions>
<decisions>
<description>Escalate Cases for High Priority Customers</description>
<name>Is_Customer_High_Priority</name>
<label>Is Customer High Priority?</label>
<locationX>284</locationX>
<locationY>342</locationY>
<defaultConnector>
<targetReference>Send_Holding_Email</targetReference>
</defaultConnector>
<defaultConnectorLabel>Send Holding Email</defaultConnectorLabel>
<rules>
<name>Escalate_Cases</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>$Record.Account.SLA__c</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<stringValue>Gold</stringValue>
</rightValue>
</conditions>
<connector>
<targetReference>Set_as_High_Priority</targetReference>
</connector>
<label>Escalate Cases</label>
</rules>
<rules>
<name>Assign</name>
<conditionLogic>or</conditionLogic>
<conditions>
<leftValueReference>$Record.OwnerId</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<elementReference>Laurence</elementReference>
</rightValue>
</conditions>
<connector>
<targetReference>Assign_to_T3_Support</targetReference>
</connector>
<label>Assign</label>
</rules>
</decisions>
<environments>Default</environments>
<formulas>
<description>If LastModifiedDate is Older than a Month</description>
<name>LastModifiedDate</name>
<dataType>Number</dataType>
<expression>ToDAY() - DATEVALUE({!$Record.LastModifiedDate})</expression>
<scale>2</scale>
</formulas>
<interviewLabel>Update Cases To Closed {!$Flow.CurrentDateTime}</interviewLabel>
<label>Update_Cases_To_Closed</label>
<processMetadataValues>
<name>BuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>CanvasMode</name>
<value>
<stringValue>FREE_FORM_CANVAS</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>OriginBuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processType>AutoLaunchedFlow</processType>
<recordUpdates>
<description>Set Fields as Ready to Archive</description>
<name>Ready_to_Archive</name>
<label>Ready to Archive</label>
<locationX>1050</locationX>
<locationY>450</locationY>
<connector>
<targetReference>Notify_DevOps_Team</targetReference>
</connector>
<inputAssignments>
<field>Comments</field>
<value>
<stringValue>Ready to Archive</stringValue>
</value>
</inputAssignments>
<inputReference>$Record</inputReference>
</recordUpdates>
<recordUpdates>
<name>Set_as_High_Priority</name>
<label>Set as High Priority</label>
<locationX>283</locationX>
<locationY>634</locationY>
<inputAssignments>
<field>Status</field>
<value>
<stringValue>Escalated</stringValue>
</value>
</inputAssignments>
<inputReference>$Record</inputReference>
</recordUpdates>
<recordUpdates>
<description>UpdateToClosed</description>
<name>UpdateToClosed</name>
<label>UpdateToClosed</label>
<locationX>782</locationX>
<locationY>573</locationY>
<inputAssignments>
<field>Status</field>
<value>
<stringValue>Complete</stringValue>
</value>
</inputAssignments>
<inputAssignments>
<field>Subject</field>
<value>
<stringValue>Resolved: {!$Record.CaseNumber}: {!$Record.Subject}: Priority{!$Record.Priority}</stringValue>
</value>
</inputAssignments>
<inputReference>$Record</inputReference>
</recordUpdates>
<start>
<locationX>530</locationX>
<locationY>48</locationY>
<connector>
<targetReference>Is_Customer_High_Priority</targetReference>
</connector>
<object>Case</object>
<recordTriggerType>Create</recordTriggerType>
<scheduledPaths>
<name>Run_after_9_Months</name>
<connector>
<targetReference>DecisionIfCaseIsClosed</targetReference>
</connector>
<label>Run after 9 Months</label>
<offsetNumber>9</offsetNumber>
<offsetUnit>Months</offsetUnit>
<timeSource>RecordTriggerEvent</timeSource>
</scheduledPaths>
<triggerType>RecordAfterSave</triggerType>
</start>
<status>Draft</status>
<subflows>
<name>Check_Service_Eligibility</name>
<label>Check Service Eligibility</label>
<locationX>76</locationX>
<locationY>571</locationY>
<flowName>setup_service_plan__CheckEligibility</flowName>
<storeOutputAutomatically>true</storeOutputAutomatically>
</subflows>
<variables>
<name>CaseStatus</name>
<dataType>Picklist</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>Label</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
<value>
<stringValue>Laurence</stringValue>
</value>
</variables>
<variables>
<name>Laurence</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>true</isOutput>
<value>
<stringValue>Laurence</stringValue>
</value>
</variables>
</Flow>