Skip to content

Commit

Permalink
Merge branch 'master' into lwc_Service_Reqs
Browse files Browse the repository at this point in the history
  • Loading branch information
AIrwin33 authored Jul 10, 2020
2 parents 12df13f + dd7f79e commit 2514fd4
Show file tree
Hide file tree
Showing 14 changed files with 422 additions and 104 deletions.
28 changes: 21 additions & 7 deletions cumulusci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
minimum_cumulusci_version: "3.12.2"
minimum_cumulusci_version: '3.12.2'
project:
name: 01HousingandHomelessness
package:
name: ReferralRecommendations
namespace: refrec
api_version: "48.0"
api_version: '48.0'
# dependencies:
# - github: 'https://github.com/SalesforceFoundation/PMM'
source_format: sfdx
test:
name_match: "Test_%"
name_match: 'Test_%'

tasks:
robot:
Expand All @@ -27,20 +27,20 @@ tasks:
description: Assigns the package's Admin permset
class_path: cumulusci.tasks.sfdx.SFDXOrgTask
options:
command: "force:user:permset:assign -n RefRecAdmin"
command: 'force:user:permset:assign -n RefRecAdmin'

assign_permset_apex:
description: Assigns the package's Admin permset
class_path: cumulusci.tasks.apex.anon.AnonymousApexTask
options:
path: "scripts/apex/PermSetAssign.apex"
path: 'scripts/apex/PermSetAssign.apex'

score_services:
description: "Score the org's data and deploy the updated CMDT"
group: "ReferralRecommendations"
group: 'ReferralRecommendations'
class_path: cumulusci.tasks.apex.anon.AnonymousApexTask
options:
apex: "Scoring.scoreAllServices();"
apex: 'Scoring.scoreAllServices();'

run_tests:
options:
Expand Down Expand Up @@ -80,3 +80,17 @@ flows:
ignore_failure: True
3:
task: score_services

install_beta:
steps:
11:
task: assign_permset_apex
ignore_failure: True
12:
task: load_dataset
options:
mapping: datasets/mapping-ns.yml
13:
task: score_services
options:
apex: 'RefRec__Scoring.scoreAllServices();'
142 changes: 142 additions & 0 deletions datasets/mapping-ns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
Insert Account:
sf_object: Account
table: Account
fields:
Id: sf_id
Name: Name
Insert Contact:
sf_object: Contact
table: Contact
fields:
Id: sf_id
FirstName: FirstName
LastName: LastName
MobilePhone: MobilePhone
Email: Email
Birthdate: BirthDate
DoNotCall: DoNotCall
HasOptedOutOfEmail: HasOptedOutOfEmail
HasOptedOutOfFax: HasOptedOutOfFax
lookups:
ReportsToId:
table: Contact
after: Insert Contact
key_field: reports_to_id
Insert RefRec__Client_Profile__c:
sf_object: RefRec__Client_Profile__c
table: Client_Profile__c
fields:
Id: sf_id
RefRec__Date_of_Birth__c: Date_of_Birth__c
RefRec__First_Name__c: First_Name__c
RefRec__Last_Name__c: Last_Name__c
RefRec__Postal_Code__c: Postal_Code__c
RefRec__Location__Latitude__s: Location__Latitude__s
RefRec__Location__Longitude__s: Location__Longitude__s
RefRec__Homeless__c: Homeless__c
RefRec__Runaway__c: Runaway__c
RefRec__Home_Owner__c: Home_Owner__c
RefRec__Home_Renter__c: Home_Renter__c
RefRec__Near_Homeless__c: Near_Homeless__c
RefRec__Employment__c: Employment__c
lookups:
RefRec__Contact__c:
key_field: contact__c
table: Contact
Insert RefRec__Service__c:
sf_object: RefRec__Service__c
table: Service__c
fields:
Id: sf_id
Name: Name
RefRec__Maximum_Age__c: Maximum_Age__c
RefRec__Minimum_Age__c: Minimum_Age__c
RefRec__City__c: City__c
RefRec__Description__c: Description__c
RefRec__Phone__c: Phone__c
RefRec__Street__c: Street__c
RefRec__Type__c: Type__c
RefRec__Website__c: Website__c
RefRec__Zip_Code__c: Zip_Code__c
RefRec__External_ID__c: External_ID__c
RefRec__Preferred__c: Preferred__c
RefRec__Location__Latitude__s: Location__Latitude__s
RefRec__Location__Longitude__s: Location__Longitude__s
RefRec__Homeless__c: Homeless__c
RefRec__Runaway__c: Runaway__c
RefRec__Home_Owner__c: Home_Owner__c
RefRec__Home_Renter__c: Home_Renter__c
RefRec__Near_Homeless__c: Near_Homeless__c
RefRec__Unemployed__c: Unemployed__c
RefRec__Retired__c: Retired__c
RefRec__Employed_part_time__c: Employed_part_time__c
RefRec__Employed_full_time__c: Employed_full_time__c
lookups:
RefRec__Account__c:
table: Account
key_field: account__c
Insert Open_Hours__c:
sf_object: RefRec__Open_Hours__c
table: Open_Hours__c
fields:
Id: sf_id
RefRec__End_Time__c: End_Time__c
RefRec__Start_Time__c: Start_Time__c
RefRec__Day__c: Day__c
lookups:
RefRec__Service__c:
table: Service__c
key_field: service__c
Insert Referral__c:
sf_object: RefRec__Referral__c
table: Referral__c
fields:
Id: sf_id
RefRec__Preferred_Channel__c: Preferred_Channel__c
RefRec__Score__c: Score__c
lookups:
RefRec__Contact__c:
table: Contact
key_field: contact__c
RefRec__Service__c:
table: Service__c
key_field: service__c
Insert Task:
sf_object: Task
table: Task
fields:
Id: sf_id
Subject: Subject
Description: Description
Status: Status
Priority: Priority
lookups:
WhoId:
table: Contact
key_field: who_id
WhatId:
table: Referral__c
key_field: what_id
Insert Service_Exclusion__c:
sf_object: RefRec__Service_Exclusion__c
table: Service_Exclusion__c
fields:
Id: sf_id
lookups:
RefRec__Contact__c:
table: Contact
key_field: contact__c
RefRec__Service__c:
table: Service__c
key_field: service__c
Insert FeedItem:
sf_object: FeedItem
table: FeedItem
fields:
Id: sf_id
Body: Body
Type: Type
lookups:
ParentId:
table: Service__c
key_field: parent_id
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ global class Batch_SendInitialClientReferrals implements Database.Batchable<SObj
global void execute(Database.BatchableContext context, List<Task> referralTasks) {
// get the referral ids from each task
List<Id> referralIds = new List<Id>();
Map<Id,Id> taskToReferralMap = new Map<Id,Id>();
for (Task referralTask : referralTasks) {
if (!referralIds.contains(referralTask.WhatId)) {
referralIds.add(referralTask.WhatId);
referralIds.add(referralTask.WhatId); // the whatId holds the id of the referral
}
}
taskToReferralMap.put(referralTask.Id, referralTask.WhatId);
}
// send the emails
if (!referralIds.isEmpty()) {
EmailService.sendInitialReferralMessages(referralIds);
EmailService.sendInitialReferralMessages(taskToReferralMap);
}
// update the tasks to completed
for (Task completedTask : referralTasks) {
completedTask.Status = TASK_STATUS_COMPLETED;
}
update referralTasks;
}
}

global void finish(Database.BatchableContext context) {
// nothing to do here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@ global class Batch_SendReferralFollowupReminders implements Database.Batchable<S
if (!reminderTasks.isEmpty()) {
// get the referral ids from each task
List<Id> referralIds = new List<Id>();
Map<Id,Id> taskToReferralMap = new Map<Id,Id>();
for (Task reminderTask : reminderTasks) {
if (!referralIds.contains(reminderTask.WhatId)) {
if (!referralIds.contains(reminderTask.WhatId)) { // the whatId holds the id of the referral
referralIds.add(reminderTask.WhatId);
}
taskToReferralMap.put(reminderTask.Id, reminderTask.WhatId);
}
if (!referralIds.isEmpty()) {
// send the messages
EmailService.sendReferralFollowupMessages(referralIds);
EmailService.sendReferralFollowupMessages(taskToReferralMap);
}
// update the tasks to completed
for (Task completedTask : reminderTasks) {
completedTask.Status = TASK_STATUS_COMPLETED;
}
update reminderTasks;
}
}

Expand Down
Loading

0 comments on commit 2514fd4

Please sign in to comment.