Snowfakery-Recipe-Templates
Snowfakery-Recipe-Templates copied to clipboard
Features/products standard pricebook
Critical Changes
Changes
Add new product recipe around NPSP membership scenario
Issues Closed
#51
@eehjunggnujhee is this ready for review?
Hi @samanthashain It has been waiting for a tester. The recipe is based on MembershipSchemaandBenefits but this recipe stands alone and use standard pricebook.
Being somewhat familiar with Products and Price Books, I decided to test this. I did it in a NPSP scratch org. The recipe runs without error. However, it only creates 1 product (AKA 1 membership type). In running the recipe with -o num_records 3 -o num_records_tablename Product2 then it creates 3 random ones out of 3 possible ones in the recipe, so naturally odds are that 2 are duplicates, which is not useful.
- Does it make more sense for the recipe to create 1 of each of the 3 products (Individual / Household / Corporate) ?
- And have the UnitPrice be different for each (instead of $250 for all memberships)?
- And set Active field value to TRUE for both Price Book Entry and Product (otherwise the records won't show up on the choices)
- Does it make more sense for the recipe to create 1 of each of the 3 products (Individual / Household / Corporate) ?
- And have the UnitPrice be different for each (instead of $250 for all memberships)?
- And set Active field value to TRUE for both Price Book Entry and Product (otherwise the records won't show up on the choices)
Hi @programmer2coder Thanks for testing. Yes your discovery is valid. I struggled around how to design a recipe on static data that were needed to be push to an org just once. I thought about copying and pasting the same recipe two more time with static value to the product type.. For some reasons, I did not like that approach. So I decided to design a recipe to random pick one product and insert only once. This leads me to a question to @prescod, Is there a way to loop items and insert only unique record once? I have here 3 product definitions and wish to push only once.
As for activating products, the cci config file has a custom task that will activate those product. Here is the custom task definition that you can find it from cumulusci.yml.
activate_standard_pricebook:
description: Activate standard price book
class_path: cumulusci.tasks.apex.anon.AnonymousApexTask
options:
apex: >
pricebook2 book = [SELECT Id FROM pricebook2 WHERE isStandard = true];
book.isActive = true;
update book;
Thank you!
hi @prescod , @acrosman, @programmer2coder
We will merge this repo after the March 2023. There are noticeable conflicts. Thank you
@eehjunggnujhee, well it's after March 2023 :)
This probably needs to be reviewed against the current status of the membership schema. @selfuntitled do you know what, if any, schema changes have happened since this was created.
We also still need to resolve the conflicts.