When generating a .yml file with generate_dataset_mapping with cumulusci it resolves in following code(sample):
Insert Product2:
sf_object: Product2
table: Product2
fields:
Id: sf_id
Name: Name
IsActive: IsActive
TestProd__c: TestProd__c
Insert Pricebook2:
sf_object: Pricebook2
table: Pricebook2
fields:
Id: sf_id
Name: Name
IsActive: IsActive
TestPB__c: TestPB__c
Insert PricebookEntry:
sf_object: PricebookEntry
table: PricebookEntry
fields:
Id: sf_id
IsActive: IsActive
UnitPrice: UnitPrice
UseStandardPrice: UseStandardPrice
test1__c: test1__c
lookups:
Pricebook2Id:
table: Pricebook2
Product2Id:
table: Product2
Extracting the data is no problem, but when loading the data (cci task run load_dataset) or using cci flow run qa_org --org qa (because of the customfields I created) the following error occures: STANDARD_PRICE_NOT_DEFINED:No standard price defined for this product:-- The reason for this error being is that the first few Insert opperations try to insert Pricebookentries for Products where there is no Standard Price configurated yet. When changing the order the same eror appears. I also tried so far:
Insert PricebookEntry:
sf_object: PricebookEntry
table: PricebookEntry
fields:
Id: sf_id
IsActive: IsActive
UnitPrice: UnitPrice
UseStandardPrice: UseStandardPrice
test1__c: test1__c
**Pricebook2.IsStandard: IsStandard**
lookups:
Pricebook2Id:
table: Pricebook2
Product2Id:
table: Product2
**filters:**
**- 'IsStandard = "true"'**
Here I want to update the Pricebook with all Products and create their standardprice. Sadly cci tries to fill in the field Pricebook2.IsStandard on the PricebookEntry but due to the fact that the field does not exists the process fails. When using fields instead of lookups for the pricebook2Id and the Product2Id it won´t work. As well as removing them won´t work because they are required. Long Story short: Is there a way to update the Pricebook instead of creating new ones and connecting them in the right manner?