On the call to $sf->client->create around line 780 in uc_sf_order.module, salesforce returns a failed response with the following message:
field integrity exception: PricebookEntryId, unknown (versions 3.0 and higher must specify pricebook entry id; others must specify product id)
Here is the data (from dpm) used to create the error:
... (Object) stdClass OpportunityId (String, 18 characters ) 0068000000ULy7WAAT Quantity (String, 1 characters ) 1 TotalPrice (String, 7 characters ) 8.00000 Description (String, 7 characters ) T-Shirt
When I add a mapping for PricebookEntryId ==> Product-Node Salesforce-Id, i get (predictably) "incorrect type" error.
The Opportunity and OpportunityContactRole are both created successfully.
Ideally, I would not have to create another mapping to manage the pricebook in Ubercart, since this a salesforce-specific concept. Ideally, I could set the price on the product and uc_salesforce would handle all the pricebook stuff that might be useful for a larger organization, but that I never use and don't want to deal with in any way.
How have you dealt with this to get Product Opportunities to work?
Comments
Comment #1
bibeksahu commentedWe don't use the Pricebook. We use a custom type, called "TFLOpportunityDetails" (which is similar to the "OpportunityLineItem" that is used with the Pricebook), to which we map the "UC Order Product" line-items.
What do you have "PricebookEntry" mapped to? What about "OpportunityLineItem"?
It kind of looks, from the picture at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_erd_p... , like you'll need a custom mapping to a Pricebook entry.
Unless you want to enhance "salesforce_api" to support a many-to-one mapping, in which case we could simplify mappings a bit. (It would certainly save me a lot of pointless nodes on drupal... maybe even eliminate the need for the "OpportunityContactRole" mapping. :-) But such a change would reach into many crevices in the "salesforce" module, and almost all modules that use it.
Comment #2
aaronbaumanRight now I don't have PricebookEntry mapped to anything - I'm hoping to avoid setting up more mappings for PricebookEntry and Pricebook.
At this point, your idea to use a custom object type sounds the most appealing, and like it will most closely match Ubercart's schema.
Do you use a sf_node mapping to keep SF TFLOpportunityDetails and UC Products in synch?
maybe a many-to-one mapping for sf_api is in store for version 3..
i'd like to get a stable 2.0 out the door first!
Comment #3
bibeksahu commentedMy relevant mappings are currently:
* User account ==> Contact
* Ubercart order ==> Opportunity
* Ubercart order product ==> TFLOpportunityDetails__c
* Donation node ==> ProjectRequest__c
* Opportunity-Contact Role (internal) node ==> OpportunityContactRole
------
The "Donation node" ==> "ProjectRequest__c" mapping uses sf_node.
The "Ubercart order product" ==> "TFLOpportunityDetails__c" uses UC-order-product.
I don't think you need to map the Donation/Product node to anything; we just do it because we want that content recorded in Salesforce, and the people who maintain the donation/product information do it from the website, not salesforce.
- Bibek
Comment #4
aaronbaumanBibek,
thanks for the detailed explanation.
I was able to get a similar setup implemented and successfully synched an order and multiple products.
My next task is to conditionally create additional opportunities for a single order, but that's a separate issue entirely.
Comment #5
EvanDonovan commentedCould this be documented in the README/a handbook page? Currently there's not really adequate documentation in the README to get started with this.
I am trying to work based off aaronbauman's patch in #811258: Compatibility with latest dev, code cleanup, some bug fixes.
It doesn't appear like there is documentation or default settings for the fields either.
Comment #6
EvanDonovan commentedOh, I see #760226: Document the setup for this module now. Closing this again.
Comment #7
EvanDonovan commentedI just started researching how Salesforce QuickBooks integration works (which we will ultimately need). Re-opening this as a feature request, since it looks like I will need the ability to create OpportunityLineItems in order to associate Products with an Opportunity and then export to QB.
Comment #8
EvanDonovan commentedI don't think I need this feature after all. Postponing.
Comment #9
EvanDonovan commentedI think there should be a way to do this with the linking object not being an outwardly-facing mappable object. That would probably be the best way to go.