Snowfakery-Recipe-Templates icon indicating copy to clipboard operation
Snowfakery-Recipe-Templates copied to clipboard

Features/products standard pricebook

Open eehjunggnujhee opened this issue 3 years ago • 6 comments

Critical Changes

Changes

Add new product recipe around NPSP membership scenario

Issues Closed

#51

eehjunggnujhee avatar Nov 18 '21 05:11 eehjunggnujhee

@eehjunggnujhee is this ready for review?

samanthashain avatar Apr 06 '22 02:04 samanthashain

Hi @samanthashain It has been waiting for a tester. The recipe is based on MembershipSchemaandBenefits but this recipe stands alone and use standard pricebook.

eehjunggnujhee avatar Apr 06 '22 03:04 eehjunggnujhee

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)

programmer2coder avatar May 18 '22 21:05 programmer2coder

  • 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!

eehjunggnujhee avatar May 21 '22 14:05 eehjunggnujhee

hi @prescod , @acrosman, @programmer2coder

We will merge this repo after the March 2023. There are noticeable conflicts. Thank you

eehjunggnujhee avatar Mar 19 '23 15:03 eehjunggnujhee

@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.

acrosman avatar Feb 05 '24 22:02 acrosman