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

FLOW: Create a Membership Transaction Business Process Listener Flow #164

Open
wants to merge 3 commits into
base: metecho/february-2024-sprint
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
2 changes: 1 addition & 1 deletion cumulusci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project:
name: Membership-Management
package:
name: Membership-Management
api_version: '59.0'
api_version: '48.0'
source_format: sfdx

tasks:
Expand Down
228 changes: 228 additions & 0 deletions force-app/main/default/flows/DPEV_Listener.flow-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<decisions>
<name>Is_Membership_lookup_populated</name>
<label>Is Membership lookup populated?</label>
<locationX>314</locationX>
<locationY>278</locationY>
<defaultConnector>
<targetReference>Get_Membership</targetReference>
</defaultConnector>
<defaultConnectorLabel>Yes</defaultConnectorLabel>
<rules>
<name>No_MembershipLookupNotPopulated</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>Get_OpportunityLineItem.Membership__c</leftValueReference>
<operator>IsNull</operator>
<rightValue>
<booleanValue>true</booleanValue>
</rightValue>
</conditions>
<connector>
<targetReference>Create_DPEV_Membership_Finder_PE</targetReference>
</connector>
<label>No</label>
</rules>
</decisions>
<decisions>
<name>Is_OpportunityProduct_same_as_Membership_Product</name>
<label>Is OpportunityProduct same as Membership Product?</label>
<locationX>578</locationX>
<locationY>494</locationY>
<defaultConnector>
<targetReference>Is_this_an_upgrade_or_downgrade</targetReference>
</defaultConnector>
<defaultConnectorLabel>No</defaultConnectorLabel>
<rules>
<name>Yes_ProductsMatch</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>Get_OpportunityLineItem.Product2Id</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<elementReference>Get_Membership.Product__c</elementReference>
</rightValue>
</conditions>
<connector>
<targetReference>Create_DPEV_Extend_Membership</targetReference>
</connector>
<label>Yes</label>
</rules>
</decisions>
<decisions>
<description>Evaluates a custom field on the OpportunityLineItem.Product2</description>
<name>Is_this_an_upgrade_or_downgrade</name>
<label>Is this an upgrade or downgrade?</label>
<locationX>842</locationX>
<locationY>602</locationY>
<defaultConnectorLabel>No Change</defaultConnectorLabel>
<rules>
<name>Upgrade</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>Get_OpportunityLineItem.Product2.Membership_Weight__c</leftValueReference>
<operator>GreaterThan</operator>
<rightValue>
<elementReference>Get_Membership.Product__r.Membership_Weight__c</elementReference>
</rightValue>
</conditions>
<connector>
<targetReference>Create_DPEV_Membership_Upgrade_PE</targetReference>
</connector>
<label>Upgrade</label>
</rules>
<rules>
<name>Downgrade</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>Get_OpportunityLineItem.Product2.Membership_Weight__c</leftValueReference>
<operator>LessThan</operator>
<rightValue>
<elementReference>Get_Membership.Product__r.Membership_Weight__c</elementReference>
</rightValue>
</conditions>
<connector>
<targetReference>Create_DPEV_Membership_Downgrade_PE</targetReference>
</connector>
<label>Downgrade</label>
</rules>
</decisions>
<description>Platform Event triggered Flow that evaluates the next action to take in Membership processing</description>
<environments>Default</environments>
<interviewLabel>DPEV Listener {!$Flow.CurrentDateTime}</interviewLabel>
<label>BPEV Listener - Create Membership Transaction Process</label>
<processMetadataValues>
<name>BuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>CanvasMode</name>
<value>
<stringValue>AUTO_LAYOUT_CANVAS</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>OriginBuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processType>AutoLaunchedFlow</processType>
<recordCreates>
<description>Create a</description>
<name>Create_DPEV_Extend_Membership</name>
<label>Create DPEV - Extend Membership</label>
<locationX>314</locationX>
<locationY>602</locationY>
<inputAssignments>
<field>Record_Id__c</field>
<value>
<elementReference>Get_Membership.Id</elementReference>
</value>
</inputAssignments>
<object>DPEV_Extend_Membership__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordCreates>
<description>Creates a Platform Event where Record_Id__c = Id of the OpportunityLineItem</description>
<name>Create_DPEV_Membership_Downgrade_PE</name>
<label>Create DPEV - Membership Downgrade PE</label>
<locationX>842</locationX>
<locationY>710</locationY>
<inputAssignments>
<field>Record_Id__c</field>
<value>
<elementReference>$Record.Record_Id__c</elementReference>
</value>
</inputAssignments>
<object>DPEV_Membership_Downgrade__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordCreates>
<description>Creates a Platform Event where Record_Id__c = OpportunityLineItem Id</description>
<name>Create_DPEV_Membership_Finder_PE</name>
<label>Create DPEV - Membership Finder PE</label>
<locationX>50</locationX>
<locationY>386</locationY>
<inputAssignments>
<field>Record_Id__c</field>
<value>
<elementReference>$Record.Record_Id__c</elementReference>
</value>
</inputAssignments>
<object>DPEV_Membership_Finder__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordCreates>
<description>Creates a Platform Event where Record_Id__c = Id of the OpportunityLineItem</description>
<name>Create_DPEV_Membership_Upgrade_PE</name>
<label>Create DPEV - Membership Upgrade PE</label>
<locationX>578</locationX>
<locationY>710</locationY>
<inputAssignments>
<field>Record_Id__c</field>
<value>
<elementReference>$Record.Record_Id__c</elementReference>
</value>
</inputAssignments>
<object>DPEV_Membership_Upgrade__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<recordLookups>
<description>Queries Membership record where Id = Membership__c lookup on OpporutnityLineItem</description>
<name>Get_Membership</name>
<label>Get Membership</label>
<locationX>578</locationX>
<locationY>386</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Is_OpportunityProduct_same_as_Membership_Product</targetReference>
</connector>
<filterLogic>and</filterLogic>
<filters>
<field>Id</field>
<operator>EqualTo</operator>
<value>
<elementReference>Get_OpportunityLineItem.Membership__c</elementReference>
</value>
</filters>
<getFirstRecordOnly>true</getFirstRecordOnly>
<object>Membership__c</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups>
<recordLookups>
<name>Get_OpportunityLineItem</name>
<label>Get OpportunityLineItem</label>
<locationX>314</locationX>
<locationY>170</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Is_Membership_lookup_populated</targetReference>
</connector>
<filterLogic>and</filterLogic>
<filters>
<field>Id</field>
<operator>EqualTo</operator>
<value>
<elementReference>$Record.Record_Id__c</elementReference>
</value>
</filters>
<getFirstRecordOnly>true</getFirstRecordOnly>
<object>OpportunityLineItem</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups>
<start>
<locationX>188</locationX>
<locationY>0</locationY>
<connector>
<targetReference>Get_OpportunityLineItem</targetReference>
</connector>
<object>BPEV_Membership_Transaction__e</object>
<triggerType>PlatformEvent</triggerType>
</start>
<status>Active</status>
</Flow>
55 changes: 55 additions & 0 deletions force-app/main/default/flows/UTILITY_create_PE.flow-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<environments>Default</environments>
<interviewLabel>UTILITY - create PE {!$Flow.CurrentDateTime}</interviewLabel>
<label>UTILITY - create PE</label>
<processMetadataValues>
<name>BuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>CanvasMode</name>
<value>
<stringValue>AUTO_LAYOUT_CANVAS</stringValue>
</value>
</processMetadataValues>
<processMetadataValues>
<name>OriginBuilderType</name>
<value>
<stringValue>LightningFlowBuilder</stringValue>
</value>
</processMetadataValues>
<processType>Flow</processType>
<recordCreates>
<name>Create_PE</name>
<label>Create PE</label>
<locationX>176</locationX>
<locationY>134</locationY>
<inputAssignments>
<field>Record_Id__c</field>
<value>
<elementReference>varRecordID</elementReference>
</value>
</inputAssignments>
<object>BPEV_Membership_Transaction__e</object>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordCreates>
<start>
<locationX>50</locationX>
<locationY>0</locationY>
<connector>
<targetReference>Create_PE</targetReference>
</connector>
</start>
<status>Draft</status>
<variables>
<name>varRecordID</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>
</Flow>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<behavior>Edit</behavior>
<field>Downgrade_Path__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>Membership_Weight__c</field>
</layoutItems>
</layoutColumns>
<layoutColumns>
<layoutItems>
Expand Down Expand Up @@ -116,7 +120,6 @@
<actionType>StandardButton</actionType>
<sortOrder>3</sortOrder>
</platformActionListItems>

<platformActionListItems>
<actionName>NewEvent</actionName>
<actionType>QuickAction</actionType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<behavior>Edit</behavior>
<field>Family</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>Membership_Weight__c</field>
</layoutItems>
</layoutColumns>
<style>TwoColumnsTopToBottom</style>
</layoutSections>
Expand Down Expand Up @@ -86,7 +90,7 @@
<showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
<showSubmitAndAttachButton>false</showSubmitAndAttachButton>
<summaryLayout>
<masterLabel>00h6t000002OIPt</masterLabel>
<masterLabel>00hDH000005vnmz</masterLabel>
<sizeX>4</sizeX>
<sizeY>0</sizeY>
<summaryLayoutStyle>Default</summaryLayoutStyle>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<deploymentStatus>Deployed</deploymentStatus>
<description>Platform Event that triggers logic based upon the Opportunity Line Item provided</description>
<eventType>HighVolume</eventType>
<label>BPEV - Membership Transaction</label>
<pluralLabel>BPEV - Membership Transactions</pluralLabel>
<publishBehavior>PublishAfterCommit</publishBehavior>
</CustomObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Record_Id__c</fullName>
<externalId>false</externalId>
<inlineHelpText>OpportunityLineItem Id</inlineHelpText>
<isFilteringDisabled>false</isFilteringDisabled>
<isNameField>false</isNameField>
<isSortingDisabled>false</isSortingDisabled>
<label>Record Id</label>
<length>255</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
</CustomField>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<deploymentStatus>Deployed</deploymentStatus>
<description>Platform Event to allow data processing for renewal</description>
<eventType>HighVolume</eventType>
<label>DPEV - Extend Membership</label>
<pluralLabel>DPEV - Extend Memberships</pluralLabel>
<publishBehavior>PublishAfterCommit</publishBehavior>
</CustomObject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Record_Id__c</fullName>
<description>Membership Id</description>
<externalId>false</externalId>
<isFilteringDisabled>false</isFilteringDisabled>
<isNameField>false</isNameField>
<isSortingDisabled>false</isSortingDisabled>
<label>Record Id</label>
<length>255</length>
<required>false</required>
<type>Text</type>
<unique>false</unique>
</CustomField>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<deploymentStatus>Deployed</deploymentStatus>
<description>Platform Event that triggers a membership downgrade</description>
<eventType>HighVolume</eventType>
<label>DPEV - Membership Downgrade</label>
<pluralLabel>DPEV - Membership Downgrades</pluralLabel>
<publishBehavior>PublishAfterCommit</publishBehavior>
</CustomObject>
Loading