• zstomeh
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
I copied the syntax below from the API samples and made a little change to read an existing field , which it did , but when reading a custom field id failed.
 
Please help.
 
========================
<html>
  <head>
  <script src="/soap/ajax/9.0/connection.js"  type="text/javascript"></script>
  <script>
    function setupPage() {
      //function contains all code to execute after page is rendered
      var state = { //state that you need when the callback is called
          output : document.getElementById("output"),
          startTime : new Date().getTime()};
      var callback = {
          //call layoutResult if the request is successful
          onSuccess: layoutResults,
          //call queryFailed if the api request fails
          onFailure: queryFailed,
          source: state};
      sforce.connection.query(
          "Select   ContractNumber, pricing_contract_number__c  From Contract order by ContractNumber limit 30",
           callback);
  }
  function queryFailed(error, source) {
    source.output.innerHTML = "An error has occurred: " + error;
  }
  /**
  * This method will be called when the toolkit receives a successful
  * response from the server.
  * @queryResult - result that server returned
  * @source - state passed into the query method call.
  */
  function layoutResults(queryResult, source) {
    if (queryResult.size > 0) {
      var output = "";
      //get the records array
      var records = queryResult.getArray('records');
      //loop through the records and construct html string
      for (var i = 0; i < records.length; i++) {
        var account = records[i];
        output +=  account.ContractNumber+ "    " +   account.pricing_contract_number__c " <br>";
      }
    //render the generated html string
    source.output.innerHTML = output;
    }
  }
  </script>
  </head>
  <body onload="setupPage()">
    <div id="output"> </div>
  </body>
</html>
I just have no idea how to login to sfdc so I can then connect to salesforce API.
 
My questions are:
How to login to sfdc from a website( which in turn builds a session)
Can it be done from an HTML page, or asp, or what?
 
A sample would be greatly appreciated.....
 
Please help,
 
I copied the syntax below from the API samples and made a little change to read an existing field , which it did , but when reading a custom field id failed.
 
Please help.
 
========================
<html>
  <head>
  <script src="/soap/ajax/9.0/connection.js"  type="text/javascript"></script>
  <script>
    function setupPage() {
      //function contains all code to execute after page is rendered
      var state = { //state that you need when the callback is called
          output : document.getElementById("output"),
          startTime : new Date().getTime()};
      var callback = {
          //call layoutResult if the request is successful
          onSuccess: layoutResults,
          //call queryFailed if the api request fails
          onFailure: queryFailed,
          source: state};
      sforce.connection.query(
          "Select   ContractNumber, pricing_contract_number__c  From Contract order by ContractNumber limit 30",
           callback);
  }
  function queryFailed(error, source) {
    source.output.innerHTML = "An error has occurred: " + error;
  }
  /**
  * This method will be called when the toolkit receives a successful
  * response from the server.
  * @queryResult - result that server returned
  * @source - state passed into the query method call.
  */
  function layoutResults(queryResult, source) {
    if (queryResult.size > 0) {
      var output = "";
      //get the records array
      var records = queryResult.getArray('records');
      //loop through the records and construct html string
      for (var i = 0; i < records.length; i++) {
        var account = records[i];
        output +=  account.ContractNumber+ "    " +   account.pricing_contract_number__c " <br>";
      }
    //render the generated html string
    source.output.innerHTML = output;
    }
  }
  </script>
  </head>
  <body onload="setupPage()">
    <div id="output"> </div>
  </body>
</html>
I do apologize if this has been brought up in the past.  I've searched the boards but this topic only seems to apply to the beta toolkit.  I'm using the productized toolkit, using the 9.0 API.  On an update, I'm trying to set a field that had a previous value to null or an empty string.  When I go back to the record after the update, the field still has the old value in it.

Any ideas?  I know in the beta version there was a fieldsToNull array where you could push fields to this array.

- Thanks much.