-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add Initial Snowfakery recipe from Jung to membership repo #90
Open
tobiasaw34002
wants to merge
7
commits into
master
Choose a base branch
from
metecho/add-initial-snowfakery-recipe-from-jung-to-membership-repo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cb48249
initialize snowfakery recipes and cci flow
mjh-jhm 6165d9b
snofakery init
mjh-jhm b63f6fb
snofakery init
mjh-jhm 03d7d61
snowfakery database extraction
mjh-jhm c31552f
snowfakery update comments
mjh-jhm a1862c0
add snowfakery_instruction.md
mjh-jhm 34c901d
Update cumulusci.yml
mjh-jhm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletions
198
datasets/MembershipSchemaAndBenefits_Opportunity.recipe.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
### ------------- [ ORDER OF INSERT ]------------ ### | ||
# 1-0. Account (1) | ||
# 1-1. Contact - (2) Household Members | ||
# 1-2. Pricebook2 (Query) | ||
# 1-3. Product2 (Query) | ||
# 1-4. PricebookEntry (Query) | ||
# 1-7. Opportunity (1) | ||
# 1-8. OpportunityLineItem (1) | ||
# 1-5. Membership__c (1) | ||
# 1-6. Membership_Contact_Role__c (automaticakly handled by Apex) | ||
|
||
|
||
### ----------- [ MembershipSchemaAndBenefits_basic.recipe.yml Summary ]---------- ### | ||
# Household Account with two contacts | ||
# Query Standard Price Book, PricebookEntry, Product2 | ||
# Pick one out of [3] products called "Individual Membership", "Household Membership", "Corporate Membership" | ||
# Membership record is specific to a related account and opportunity records. | ||
# Membership Contact role differenciates the membership details on each household member. | ||
# There is an apex trigger handler that creates a membership contact role for primary contact. | ||
# https://github.com/SFDO-Community-Sprints/MembershipSchemaAndBenefits | ||
|
||
|
||
### ----------- [ CLI RUN ]---------- ### | ||
|
||
# cci task run snowfakery --recipe datasets/MembershipSchemaAndBenefits_Opportunity.recipe.yml --drop_missing_schema True --org membership | ||
# snowfakery --output-format json --output-file foo.json datasets/MembershipSchemaAndBenefits_Opportunity.recipe.yml --plugin-option org_name membership | ||
|
||
### ----------- [ Recipe Starts ]---------- ### | ||
|
||
- plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery | ||
|
||
- object: temp | ||
fields: | ||
__oppDate: | ||
date_between: | ||
start_date: -1y | ||
end_date: today | ||
__firstname: | ||
fake: firstname | ||
__lastname: | ||
fake: lastname | ||
__pricebookentry_from_salesforce: | ||
SalesforceQuery.random_record: | ||
fields: Id, UnitPrice, Product2Id, Product2.Name | ||
from: PricebookEntry | ||
where: Product2.Name like '% Membership' | ||
__membershipType: | ||
if: | ||
- choice: | ||
when: ${{__pricebookentry_from_salesforce.Product2.Name == 'Individual Membership'}} | ||
pick: Individual | ||
- choice: | ||
when: ${{__pricebookentry_from_salesforce.Product2.Name == 'Household Membership'}} | ||
pick: Household | ||
- choice: | ||
when: ${{__pricebookentry_from_salesforce.Product2.Name == 'Corporate Membership'}} | ||
pick: Corporate | ||
|
||
|
||
- object: Account | ||
fields: | ||
# MembershipSchemaAndBenefits custom fields -- expected to be handled by Apex | ||
First_Membership_Start_Date__c: ${{temp.__oppDate}} | ||
Membership_End_Date__c: ${{temp.__oppDate+relativedelta(months=12)}} | ||
Membership_Status__c: | ||
random_choice: | ||
- Former | ||
- Lapsed | ||
- Renewal | ||
- Current | ||
Membership_Type__c: ${{temp.__membershipType}} | ||
# random_choice: | ||
# - Individual | ||
# - Household | ||
# - Corporate | ||
Name: | ||
if: | ||
- choice: | ||
when: ${{temp.__membershipType == 'Individual'}} | ||
pick: ${{temp.__firstname}} ${{temp.__lastname}} Household | ||
- choice: | ||
when: ${{temp.__membershipType == 'Household'}} | ||
pick: ${{temp.__firstname}} ${{temp.__lastname}} Household | ||
- choice: | ||
when: ${{temp.__membershipType == 'Corporate'}} | ||
pick: ${{fake.company}} | ||
|
||
- object: Contact | ||
fields: | ||
# MembershipSchemaAndBenefits custom fields -- expected to be handled by Apex | ||
Last_Membership_Start_Date__c: ${{temp.__oppDate}} | ||
First_Membership_Start_Date__c: ${{temp.__oppDate}} | ||
Membership_End_Date__c: ${{temp.__oppDate+relativedelta(months=12)}} | ||
Membership_Status__c: ${{Account.Membership_Status__c}} | ||
Membership_Type__c: ${{Account.Membership_Type__c}} | ||
FirstName: ${{temp.__firstname}} | ||
LastName: ${{temp.__lastname}} | ||
Email: ${{fake.email}} | ||
AccountId: | ||
reference: Account | ||
|
||
- object: Opportunity | ||
fields: | ||
Type: Membership | ||
CloseDate: ${{temp.__oppDate}} | ||
Description: | ||
fake.text: | ||
max_nb_chars: 100 | ||
|
||
StageName: Closed Won | ||
# Contact | ||
Name: ${{Account.Name}}-${{Account.Membership_Type__c}}-${{CloseDate}} | ||
AccountId: | ||
reference: Account | ||
|
||
# NPSP fields | ||
# npe01__Membership_Start_Date__c: ${{CloseDate}} | ||
# npe01__Membership_End_Date__c: ${{date(CloseDate)+relativedelta(months=12)}} | ||
# npe01__Membership_Origin__c: | ||
# random_choice: | ||
# - New | ||
# - Renewal | ||
# - Reacquire | ||
|
||
Amount: ${{temp.__pricebookentry_from_salesforce.UnitPrice}} | ||
|
||
Pricebook2Id: | ||
SalesforceQuery.random_record: | ||
from: Pricebook2 | ||
|
||
- object: OpportunityLineItem | ||
fields: | ||
Quantity: 1 | ||
Description: | ||
fake.text: | ||
max_nb_chars: 30 | ||
|
||
OpportunityId: | ||
reference: Opportunity | ||
|
||
UnitPrice: ${{Opportunity.Amount}} | ||
Product2Id: ${{temp.__pricebookentry_from_salesforce.Product2Id}} | ||
# Membership__c: | ||
Membership__c: | ||
- object: Membership__c | ||
fields: | ||
name: ${{Account.Name}}-${{temp.__pricebookentry_from_salesforce.Product2.Name}} | ||
Origin__c: | ||
random_choice: | ||
- New | ||
- Renewed | ||
- Reacquired | ||
Primary__c: true | ||
Status__c: | ||
random_choice: | ||
- Former | ||
- Lapsed | ||
- Renewal | ||
- Current | ||
Type__c: | ||
if: | ||
- choice: | ||
when: ${{temp.__pricebookentry_from_salesforce.Product2.Name == 'Individual Membership'}} | ||
pick: Individual | ||
- choice: | ||
when: ${{temp.__pricebookentry_from_salesforce.Product2.Name == 'Household Membership'}} | ||
pick: Household | ||
- choice: | ||
when: ${{temp.__pricebookentry_from_salesforce.Product2.Name == 'Corporate Membership'}} | ||
pick: Corporate | ||
|
||
Does_Not_Expire__c: false | ||
Start_Date__c: ${{Opportunity.CloseDate}} | ||
End_Date__c: ${{date(Start_Date__c)+relativedelta(months=12)}} | ||
|
||
Account__c: | ||
reference: Account | ||
|
||
Primary_Contact__c: | ||
reference: Contact | ||
Opportunity__c: | ||
reference: Opportunity | ||
Product__c: ${{temp.__pricebookentry_from_salesforce.Product2Id}} | ||
|
||
|
||
# Apex automated | ||
# - object: Membership_Contact_Role__c | ||
# fields: | ||
# Name: STRING | ||
# Start_Date__c: DATE | ||
# End_Date__c: DATE | ||
# Role__c: PICKLIST | ||
|
||
# Is_Primary__c: BOOLEAN | ||
|
||
# Membership__c: REFERENCE | ||
# Contact__c: REFERENCE | ||
|
88 changes: 88 additions & 0 deletions
88
datasets/MembershipSchemaAndBenefits_PricebookProducts.recipe.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
### ------------- [ ORDER OF INSERT ]------------ ### | ||
# 1-0. Product2 [3] | ||
# 1-1. PricebookEntry [3] | ||
|
||
|
||
### ----------- [ MembershipSchemaAndBenefits_basic.recipe.yml Summary ]---------- ### | ||
# Create [3] products called "Individual Membership", "Household Membership", "Corporate Membership" | ||
# Create 3 Price book entries to the standard price book | ||
# https://github.com/SFDO-Community-Sprints/MembershipSchemaAndBenefits | ||
# Run at the pre-configuration | ||
|
||
|
||
### ----------- [ CLI RUN ]---------- ### | ||
|
||
# cci task run snowfakery --recipe datasets/MembershipSchemaAndBenefits_PricebookProducts.recipe.yml --org dev | ||
# snowfakery --output-format json --output-file src/foo.json datasets/MembershipSchemaAndBenefits_PricebookProducts.recipe.yml --plugin-option org_name dev | ||
### ----------- [ Recipe Starts ]---------- ### | ||
|
||
- plugin: snowfakery.standard_plugins.Salesforce.SOQLDataset | ||
|
||
- object: Product2 | ||
nickname: p1 | ||
fields: | ||
Name: Individual Membership | ||
ProductCode: INDVDL-MEMBER-ANNUAL | ||
Description: | ||
fake.text: | ||
max_nb_chars: 50 | ||
StockKeepingUnit: #sku | ||
Family: Annual Membership | ||
|
||
- object: PricebookEntry | ||
fields: | ||
IsActive: true | ||
UnitPrice: 250 | ||
Product2Id: | ||
reference: p1 | ||
__pricebook_from_salesforce: | ||
SOQLDataset.shuffle: | ||
fields: Id | ||
from: Pricebook2 | ||
Pricebook2Id: ${{__pricebook_from_salesforce.Id}} | ||
|
||
- object: Product2 | ||
nickname: p2 | ||
fields: | ||
Name: Household Membership | ||
ProductCode: HSHLD-MEMBER-ANNUAL | ||
Description: | ||
fake.text: | ||
max_nb_chars: 50 | ||
StockKeepingUnit: #sku | ||
Family: Annual Membership | ||
|
||
- object: PricebookEntry | ||
fields: | ||
IsActive: true | ||
UnitPrice: 250 | ||
Product2Id: | ||
reference: p2 | ||
__pricebook_from_salesforce: | ||
SOQLDataset.shuffle: | ||
fields: Id | ||
from: Pricebook2 | ||
Pricebook2Id: ${{__pricebook_from_salesforce.Id}} | ||
|
||
- object: Product2 | ||
nickname: p3 | ||
fields: | ||
Name: Corporate Membership | ||
ProductCode: CRPRT-MEMBER-ANNUAL | ||
Description: | ||
fake.text: | ||
max_nb_chars: 50 | ||
StockKeepingUnit: #sku | ||
Family: Annual Membership | ||
|
||
- object: PricebookEntry | ||
fields: | ||
IsActive: true | ||
UnitPrice: 250 | ||
Product2Id: | ||
reference: p3 | ||
__pricebook_from_salesforce: | ||
SOQLDataset.shuffle: | ||
fields: Id | ||
from: Pricebook2 | ||
Pricebook2Id: ${{__pricebook_from_salesforce.Id}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this line is a typo @eehjunggnujhee