• Miss Amy
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have a custom object tracking professional services engagements based on accounts. I have added a field to select the contact for the engagement from the contacts associated with the account. I would like to add an S-Control to pull in the phone number and email address but the following code is not bringing back anything.
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>

<script>
dojo.addOnLoad(init);

function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Name, Phone, Email FROM Contact where ID = '{!Contact.Id}', callback);
}

function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
while(it.hasNext()) {
var record = it.next();
html.push("Name = " + record.Name + "<br>");
html.push("Phone = " + record.Phone + "<br>");
html.push("Email = " + record.Email + "<br>");
html.push("<hr>");
html.push("<br>");
}

document.getElementById("output-div").innerHTML = html.join("");
}

function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>


</head>
<body>

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

</body>
</html><html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>

<script>
dojo.addOnLoad(init);

function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Name, Phone, Email FROM Contact where ID = '{!Contact.Id}', callback);
}

function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
while(it.hasNext()) {
var record = it.next();
html.push("Name = " + record.Name + "<br>");
html.push("Phone = " + record.Phone + "<br>");
html.push("Email = " + record.Email + "<br>");
html.push("<hr>");
html.push("<br>");
}

document.getElementById("output-div").innerHTML = html.join("");
}

function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>


</head>
<body>

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

</body>
</html>
 
Do I need to display the contact ID on the page? If so how would i associate it with the contact?
 
Any help or suggestions are greatly appreciated.
 
Thanks!
Amy
I have a custom object tracking professional services engagements based on accounts. I have added a field to select the contact for the engagement from the contacts associated with the account. I would like to add an S-Control to pull in the phone number and email address but the following code is not bringing back anything.
 
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>

<script>
dojo.addOnLoad(init);

function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Name, Phone, Email FROM Contact where ID = '{!Contact.Id}', callback);
}

function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
while(it.hasNext()) {
var record = it.next();
html.push("Name = " + record.Name + "<br>");
html.push("Phone = " + record.Phone + "<br>");
html.push("Email = " + record.Email + "<br>");
html.push("<hr>");
html.push("<br>");
}

document.getElementById("output-div").innerHTML = html.join("");
}

function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>


</head>
<body>

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

</body>
</html><html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>

<script>
dojo.addOnLoad(init);

function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Name, Phone, Email FROM Contact where ID = '{!Contact.Id}', callback);
}

function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
while(it.hasNext()) {
var record = it.next();
html.push("Name = " + record.Name + "<br>");
html.push("Phone = " + record.Phone + "<br>");
html.push("Email = " + record.Email + "<br>");
html.push("<hr>");
html.push("<br>");
}

document.getElementById("output-div").innerHTML = html.join("");
}

function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>


</head>
<body>

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

</body>
</html>
 
Do I need to display the contact ID on the page? If so how would i associate it with the contact?
 
Any help or suggestions are greatly appreciated.
 
Thanks!
Amy
Hello,

I am wondering if the excel connector would work to load data into a test environment?

thanks
  • December 06, 2005
  • Like
  • 0