function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
M.M. 

logging in with javascript and retrieving data

Hello once again... I've been trying to get some information from salesforce fields...

I've created a javascript that allows me to access the solutions table and access its fields...

this works well in a s-control... now, what I want is to access it from a external website... I know that, in order to do that, i'll need the login and password, but i don't know how to make that connection... can anyone help me? here goes the code sample...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>

<script>

<!--

function initPage()
{
sforceClient.registerInitCallback(setup);

sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", true);
}

//Use this function as the entry point for your DHTML and JAVASCRIPT processing

function setup()
{
var queryResult = sforceClient.query("Select Id, Status, SolutionNote From Solution", layoutResults);

}

function layoutResults(queryResult)
{

if (queryResult.className == "Fault")
{
alert("There was an error: " + queryResult.toString());

}

else
{
if (queryResult.size > 0)
{

var output = "";

for (var i=0;i<queryResult.records.length;i++)
{

var dynaBean = queryResult.records[i];

output += dynaBean.get("Id") + " " + dynaBean.get("Status") +" "+ dynaBean.get("SolutionNote") +"<br>";

}

var textNode = document.createTextNode(output);

document.getElementById("output").innerHTML = output;

}

else
{
var textNode = document.createTextNode("No records matched.");

}
}
}

//-->

</script>
<script>
alert("Testing")
</script>

</head>

<body onload="initPage()">

<div id="output"></div>

</body>

</html>
DevAngelDevAngel
Hi M.,

You need to create a java or .net or php or some client appropriate for your web server environment that makes the same calls to salesforce as your javascript.  See the sample code on ADN for details.



Cheers