I'm finding some good examples using the API with other languages, but none in Java/APEX for SalesForce. And none that get into what I need to.
I can probably wing it though I'm having difficulty starting it off and it's taking too much time.
For now I've created an APEX/VisualForce page that simply generates an HTML form based off the Account, Contact, Opportunity, and Products created in SalesForce. This sends a simple POST after clicking the submit button that's sent to mydomain.foxycart.com/cart
This at least pre-populates the email, shipping info, products, etc.. However I'd also like to send the password, which I can't seem to do, but that's not the real question.
What I'd like to do is when the order is processed I want to send some data plus the transaction ID back to SalesForce. Maybe not all data, just the transaction is great and then somehow at an interval like every 5 minutes or once a day I want to pull a FULL feed and synchronize FoxyCart with SalesForce. I want to do this because SalesForce will sometimes have down times and I'd rather have a way to be certain we have all the orders and customer info captured.
I'm not even sure where to start. I have one issue in that our website uses the cart as well. I'd have to somehow pass data to FoxyCart to tell it where the order is coming from (SalesForce/Website). After the order is processed FoxyCart would send this parameter to my page and the page could determine what to do with it.
I've read all the API docs I could find and can't get the start I need. Please Help!
You don't need to know Java or APEX to help me. Just in direction of what I need to do will suffice.
I promise to post my work for all other SalesForce developers if you can get me on the right track!
Thanks in advance!
-RJ
So it sounds like there are 2 things here. Or maybe 3.
1) Get an add-to-cart form from Salesforce -> FoxyCart.
2) Prepopulate or synchronize Salesforce contacts with FoxyCart customers.
3) Get data back into Salesforce.
For #1 is sounds like you have it handled, though you mentioned the password issue with gets into #2. Also, if you need to differentiate between Salesforce and website sales you could add a h:transaction_source=salesforce parameter or something that'd be present in the XML datafeed (#3).
For #2 it sounds like you're prepopulating, which will work for some things but not for passwords. The recommended approach would be to synchronize Salesforce contacts to FoxyCart users:
http://wiki.foxycart.com/static/redirect/api
We're rolling out some new functionality in v0.7.1 very soon also that will give more flexibility with password hashing:
http://wiki.foxycart.com/v/0.7.0/customers#synchronizing_users_and_passwords
How do you have the passwords stored and available in Salesforce? Can you handle creating users via the FC API from Salesforce?
For #3, that'd be the XML datafeed:
http://wiki.foxycart.com/static/redirect/xml_datafeed
And this might be at least somewhat useful:
http://wiki.foxycart.com/integration/salesforce
Does any of that help? Perhaps we should break it down a little more if anything's unclear so we can focus on one piece at a time.
Luke, not for Java/APEX.
I was hoping I could create a transaction sync rather than just a datafeed. Sounds Like may not be able to do that though it does say I can do this via the API. If there is more on this can you send a link?
If not here are my steps:
My Website is PHP and this would be the Publicly Accessible End Point. This site would host a page that would receive the transaction (with parameter as to where the transaction came from) and pass to SalesForce. The PHP would do a number of things. It would first look in Contacts for a Matching contact on Email. If one found the transaction would be created as a Closed/Won Opportunity with all the related products added to it. If no contact was found it would search leads. If a lead was found then it would convert the lead to an Account, Contact and Opportunity and add the products from the feed.
Next is the Sync contacts. I would probably do this via SalesForce in APEX/Java. I would have a Scheduled Class that ran to update either record depending on what record was modified last.
I'll wait for the Password project until all of this is finished, but again I had my hopes on synchronizing transactions as well. Please give me some good news
If you're just wanting historical data for transactions that already took place (and not a real time sync with the datafeed) you can use the API and the transaction_list api call.
Does that help?
I've got an interesting method coming. Once I complete I'll post
There is always a Division by zero error. Error below:
DataFeed Failed: (3152824) 2011-03-01 22:48:35 Datafeed Returned: ispwdHex = 0) { return rc4crypt::encrypt($pwd, $data, $ispwdHex); } } ?> <br /> <b>Warning</b>: Division by zero in <b>/html/sfdc/FOXYCART/7/class.rc4crypt.php</b> on line <b>51</b><br /> <br /> <b>Warning</b>: Division by zero in <b>/html/sfdc/FOXYCART/7/class.rc4crypt.php</b> on line <b>51</b><br /> <br /> <b>Warning</b>: Division by zero in <b>/html/sfdc/FOXYCART/7/class.rc4crypt.php</b> on line <b>51</b>
Any help? Everytime I google: "rc4crypt Division by zero error" I get hundreds of sites WITH that very error lol... It's mind blowing. You'd think I'd find something tangible. Is there anything out there besides rc4crypt i should try maybe?
The error message is from line 51:
$pwd_length comes from
my hunch... is that you're not passing in a password?