0

I am new to Web development (switch from C++), and was asked to develop a demo that is able to input customer records from Salesforce and present them on HTML (an HTML form), and possibly update the data and send back to Salesforce.

I only know some of the basics of web service, HTML, JavaScript and css. I was reading tutorials on trailhead, but it seems it only teaches you how to develop apps for Salesforce platform.

So as a beginner, I'd like to ask, in order to implement aforementioned functions, what aspects of work should be done, and some directions (e.g about what Salesforce API should I use, the design and implementation of the functions) for me to dig in. I understand I have much to learn and I would appreciate any input here.

3
  • 1
    If you just want to store the data in Salesforce, I suggest you make use of JSON REST API calls. A start point on learning about this is this REST API page. Assuming you are being asked to do this from an existing application that already has its own authentication, then the additional authentication required to access Salesforce can be awkward to accommodate. If not, then the quickest approach is to build everything in Salesforce.
    – Keith C
    Commented Jan 1, 2016 at 19:56
  • 1
    You could even use something like web-to-lead if you want a very simple way to capture new potential customers. Is there a particular use case you are looking to fulfill?
    – pchittum
    Commented Jan 2, 2016 at 8:10
  • @Peter the scenario for me is to pull account/record data from Salesforce, and present them on our own website.
    – daiyue
    Commented Jan 2, 2016 at 11:07

2 Answers 2

2

if you want to display data from Salesforce you can use JSON REST API which is widely used solution to read data from Salesforce and update data from external application. Salesforce provide different force.com SDK which make this process very easy.

Here are some sample code which can help you to get started:

PHP SDK example:

<?php
// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.com password

define("SOAP_CLIENT_BASEDIR", "../../soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');

require_once ('../userAuth.php');

try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');
  $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

  $query = 'SELECT Id,Name,BillingStreet,BillingCity,BillingState,Phone,Fax from Account Limit 1';
  $response = $mySforceConnection->query($query);
  $queryResult = new QueryResult($response);

  for ($queryResult->rewind(); $queryResult->pointer < $queryResult->size; $queryResult->next()) {
    print_r($queryResult->current());
  }

} catch (Exception $e) {
  print_r($mySforceConnection->getLastRequest());
  echo $e->faultstring;
}
?>

Here is the .NET sample code from .NET SDK

var client = new ForceClient(auth.InstanceUrl, auth.AccessToken, auth.ApiVersion);

// retrieve all accounts
Console.WriteLine("Get Accounts");

const string qry = "SELECT ID, Name FROM Account";
var accts = new List<Account>();
var results = await client.QueryAsync<Account>(qry);
var totalSize = results.TotalSize;
Console.WriteLine("Queried " + totalSize + " records.");

You can also use JavaScript rest API

So at the end you can see different option which can be used to integrate Salesforce with your application. you need to only define your requirement first.

2

If you are interested in doing a quick demo in Salesforce, you can use Visualforce (VF) and Apex technology to very quickly stand up a page or two to show a list of customers and the data entry for a new customer. You can do all of this with a couple of VF pages and the use of standard controllers meaning very little Apex coding. VF tags are somewhat similar to HTML tags and the generated code when the page renders is HTML. This will work great if you want to serve up your UI from SF rather than integrating to it like a back-end database. If you want to pursue the latter approach, you can follow some of the other suggestions already provided. I just saw your follow up response - using the REST API would be your best bet.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .