• ajax-theikos
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies

hi , i am trying to run this scontrol in IE. But i get sforce object is not defined.

 here i am giving my code. please help me

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<SCRIPT
src="http://na1.salesforce.com/soap/ajax/8.0/connection.js"
type=text/javascript></SCRIPT>
<script language="javascript">
 var opportunityStage = '{!Opportunity.StageName}';
 var oppId = '{!Opportunity.Id}';
 

function init()
{
   sforce.connection.init("{!API.Session_ID}","{!API.Partner_Server_URL_70}");
   alert("login");
    window.parent.location.href = "https://na3.salesforce.com/"; 
}

 

</script>
</head>
<body class="account detailPage" topmargin="0" leftmargin="0"
onLoad="javascript:init()">

</body>
</html>

 

    hi . i am trying to login into salesforce using new ajax toolkit.
 but i could not get login.

 this is the code i am tried.
<html>
<head>
<script src="https://na1.salesforce.com/soap/ajax/8.0/connection.js" type="text/javascript"></script>
<script>

 function login()
 {
    try
    {
    sforce.connection.login("username","password");
    result = sforce.connection.query("Select Name, Id from Account");
    records = result.getArray("records");
    for (var i=0; i<records.length; i++)
    {
    var record = records[i];
    alert(record.Name + " -- " + record.Id);
    }
    }
    catch(e)
    {
     alert(e);
    }

 }

</script>
</head>
29
<body onload="login()">
<div id="output"></div>
</body>
</html>

BUT i GET This Exception
 "NS_ERROR_FILE_UNRECOGNIZED_PATH"

 if i am using this url "<script src="/soap/ajax/8.0/connection.js" type="text/javascript"></script>"
 
i got error like sforce is not defined.

plz any one help me  out.
regards prasad.

Message Edited by DevAngel on 03-15-2007 01:05 PM