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

In-Line S-Control Resolution help
I'm working on an S-control that pulls the date of the most recent Opportunity belonging to an Account and displays that. My problem is that when I attempt to format the field to align with the rest of SFDC fields, it works for the resolution I'm operating on, but as soon as that resolution changes it falls out of sync. I've tried using %, em, and px, and nothing seems to understand the resolution change. How does Salesforce do it?
Code below:
Code below:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" > <link href="/dCSS/Theme2/default/custom.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" > <script type="text/javascript" src="/js/functions.js"></script> <script type="text/javascript" src="/js/setup.js"></script> <script src="/soap/ajax/9.0/connection.js"></script> <html> <head> <script type="text/javascript"> function init() { sforce.connection.sessionId = "{!$Api.Session_ID}"; var acctid="{!Account.Id}"; var LatestOpportunity=sforce.connection.query("Select CloseDate from Opportunity Where AccountId='" + acctid + "'"); var LOrecs = LatestOpportunity.getArray('records'); var closeDate=LOrecs[0].get("CloseDate"); if(LatestOpportunity.size > 1){ for(x=1;x<LatestOpportunity.size;x++) { if(LatestOpportunity.records[x].get("CloseDate")>closeDate) { closeDate=LatestOpportunity.records[x].get("CloseDate"); } } } document.getElementById("date").innerText=closeDate; document.getElementById("date").textContent=closeDate; } </script> </head> <body class='account' onLoad='init()'> <DIV class="bPageBlock secondaryPalette" style="border-top:0px; border-bottom:0px; margin-bottom:0px; padding-bottom:0px"> <DIV class=pbBody style="margin-right:0px"> <DIV class=pbSubsection> <div class=labelCol style="text-align:left; position:relative; left:11%; top:20%"> Last Order Date       <span id='date'><br><br><br></div></div></div></div> </body>
By including the label of the sControl in the page layout you'll force the text to align properly regardless of resolution.
I don't usually like to rewrite someone elses code but I thought you were doing a lot of additional work in your code which could have been eliminated in the query itself. Feel free to modify as needed.
-greg
Message Edited by Greg H on 01-08-2008 02:12 PM
Message Edited by Greg H on 01-08-2008 02:13 PM
I didn't know SOQL supported stuff like ORDER BY. That'll be a great help in the future.
Thanks a bunch!