You need to sign in to do that
Don't have an account?

How to create a S-Control with merge fields?
Hi there,
I need to create a S-Control which will display the fields (2) from the oppurtunity tab and 3 from the Accounts Object.
This Scontrol will be displayed on the Oppurtunity tab.
Any ideas how to S-controls with the merge fields?
thanks
I need to create a S-Control which will display the fields (2) from the oppurtunity tab and 3 from the Accounts Object.
This Scontrol will be displayed on the Oppurtunity tab.
Any ideas how to S-controls with the merge fields?
thanks
Did you solve the problem?? Now I have the same requirement. Is it possible that you help me?
Thanks
HIbarra
Like I said, that I am still working on it , so I dont have a final answer for you as of yet.
thanks
<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
};
alert("start");
sforce.connection.query
(
"Select o.AccountId, o.Account.BillingCity, o.Account.BillingCountry, o.Account.BillingPostalCode, o.Account.BillingState, o.Account.BillingStreet, o.Account.Fax, o.Account.Id, o.Account.Name, o.Account.Phone, o.Account.Website, o.Id, o.Name, o.OwnerId, o.Owner.Name from Opportunity o where o.Id = '{!Opportunity.Id}' ",callback);
alert("end query");
}
function queryFailed(error, source)
{
alert("QueryFailed...");
source.output.innerHTML = "An error has occurred - query: " + error;
}
function layoutResults(queryResult, source)
{
var output = ""; // this variable will store the data and display the results using HTTP POST method.
if (queryResult.size > 0)
{
//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 Opportunity= records[i];
output.requestData += "Opportunity Account ID=" + Opportunity.AccountId + "," +
"Opportunity Name=" + Opportunity.Name + "," +
"Opportunity ID=" + Opportunity.Id + "," +
"Account Billing City=" + Opportunity.Account.BillingCity + "," +
"Account Billing Country=" + Opportunity.Account.BillingCountry+ "," +
"Account Billing Postal Code=" + Opportunity.Account.BillingPostalCode+ "," +
"Account Billing State=" + Opportunity.Account.BillingState + "," +
"Account Billing Street=" + Opportunity.Account.BillingStreet + "," +
"Account Fax=" + Opportunity.Account.Fax + "," +
"Account ID=" + Opportunity.Account.Id + "," +
"Account Name=" + Opportunity.Account.Name + "," +
"Account Phone=" + Opportunity.Account.Phone + "," +
"Account Website=" + Opportunity.Account.Website + "," +
"Opportunity Owner ID=" + Opportunity.OwnerId + "," +
"Opportunity Owner Name=" + Opportunity.Owner.Name;
// Using HTTP POST method to send data starts here
sforce.connection.remoteFunction({
url : "http://www.cheenath.com",
onSuccess : function(response) {
alert("Got response" + response);
},
onFailure : function(error) {
alert("ERROR: " + error);
},
async: false
});
} // this is the closing for FOR loop
} // this is the closing bracket for IF loop for records array.
//render the generated html string
// Comment this out if you are sending data from Salesforce to localhost.
//source.output.innerHTML = output;
} // this is closing bracket for FUNCTION where you have defined OUTPUT as the variable.
</script>
</head>
<body onload="setupPage()">
<div id="output"> </div>
</body>
</html>