0

OK, I can be more specific now.

Tried now to simply create new opportunity line items, however, I get this error message:

esponse content: [{'message': "Error: You can't select products until you've chosen a price book for this opportunity on the products related list.", 'errorCode': 'REQUIRED_FIELD_MISSING', 'fields': []}] Code:

new_opportunity_line_item = SFType('OpportunityLineItem', session_id, instance)

data = {
#'PricebookEntryId': '01s0Y0000032iVBQAY',
'UnitPrice': 310.32,
'OpportunityId' : '0061v00000urNkyAAE', 
'Quantity' : '20',        
'Product2Id' : '01t1v00000I8xtyAAB'  , 
'Customer_PO__c' : '7113447008' 
}

response = new_opportunity_line_item.create(data)

I started yesterday with simple_salesforce, now I wanted to upload a dataframe that includes 30 products to a new opportunity that I created.

Any examples or links for reading?

I know, this is probably quite simple, but I did not find the right sources.

Thanks for your support!

0

1 Answer 1

1

Sorry, to spam you here. After trying several options, I found the solution by myself...

When creating the opportunity, you need to assign a price book.

'Pricebook2Id' : '01s0Y0000032iVBQAY'  

This price book needs to be assigned to the opportunity, not the opportunityLineItem. I got the error message when creating the opportunityLineItem.

Anyway, Thanks for your support / people who tried to help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.