You need to sign in to do that
Don't have an account?
Brand new to custom work, need big push in the right direction
Hoping I can get some guidance on a scenario. Current company web site has a catalog of items (not a store front or shopping application). I have created a custom object in SalesForce that echos the fields that are displayed on the site and obviously in the database. I want to have an action button on the web page that when clicked, will add an object instance to Salesforce.
For example, lets say the custom object is named Widget. I want to create a new widget instance from the web site and hence database in Salesforce. I need to put some code in the web site to do this, and I am at a total loss wher to begin. I am hoping someone might help me with some code snippets that I can extend to cover all the fields.
Okay, object is widget and let's assume widget has a custom field called name. Given that, what are the steps and code example that would:
- Set up for initiating the API to start a session.
- Logon
- Query widget to see if the name field is already in existence.
- If not, create the new widget instance. create() I guess or ???
- Update the field name.
- Commit all the field updates, as in Post or something similar.
- Validate the create was successful.
- Logoff
- End the session
Quickly trying for cookbook hints, browsing AJAX documentation, etc. exposed a number of things that raised questions to me: .net, php, java, ..... Is this going to be all over the place depending on how the existing web site is constructed?
Forewarned that I am a bit of a hack, at best, in this world, although a former developer but not a contemporary one, so what may be completely obvious to you is probably a fog for me.
Thanks in advance, and if snippets are not your thing per se perhaps pointing me to the right KB or documenation would help. So far, the documentation I have whacked at has done me little good.
And maybe someone could explain why the simple code in web->lead isn't available for other objects? It would make such sense.
You should look in to salesforce sites.
at a high level, here is what you have to do:
Create a visualforce page with a custom controller for you widget object. Make sure the Custom controller has 'without sharing' specified . The custom controller is what will handle the querying of the database for existing records and creating a new record if one does not already exist.
Create a 'Site' by going to Setup | Develop | Sites
Use your custom visualforce page (that uses your custom controller) as the main page on your 'site'.
if you want, you can send me a private message and i'll work with you to get some code hashed out.
Victor