You need to sign in to do that
Don't have an account?
Kringo
Inline S~Control ~and I'm stuck
I'm a admin with a couple years under my belt trying to learn some of
this code stuff. I've been working on this piece for a few hours (i'm
embarressed to say how many) and I'm stuck. I've posted the code. What
I'm trying to do is use an inline scontrol to display account site info
in a record that is at the detail end of a relationship with account.
Code:
any nudge in the right direction would be much appreciated
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Account</title> <!-- Include the SalesForce style sheets --> <link href="/sCSS/Theme2/en/common.css media="handheld,print,projection,screen,tty,tv" rel="stylesheet" type="text/css" /> <link href="/sCSS/10.0/Theme2/allCustom.css" media+"handheld,print,projection,screen,tty,tv" rel="stylesheet" type="text/css" /> <-- get the AJAX toolkit --> <script src="/soap/ajax/10.0/connection.js"></script> <script> var AccountId= "{!Service__c.Account__c}"; function failure(error) { document.body.innerHTML += "Error retrieving Account info"; document.body.innerHTML += "<br>API Error: " + error; } function initPage() { try{ //alert(AccountId); var result = sforce.connection.retrieve("Account_Site, Owner","Account" [AccountId], {onSuccess: render, onFailure: failure}); } catch (e) { document.body.innerHTML += "Error retrieving Account info"; document.body.innerHTML += "<br>Fault code: " + e.faultcode; document.body.innerHTML += "<br>Fault string: " + e.faultstring; } } function render(result) { try { var record = result [0]; var output = "<div class='bPageBlock secondaryPalette' id='ep'>"; output += "<div class='pbHeader'>"; output += "<div class='pbBody'>"; output += "<div class='pbSubsection' style='display: block;'>" output += "<tr>"; output += "<td class='labelCol'>Account</td>" output += "<td class='dataCol col02'><a target='_top' href=/" + AccountId + ">" + record.Account_Name + "</a></td>" <td class='labelCol empty'> </td> <td class='dataCol empty'> </td>"; output += "</tr>"; output += "<tr>"; output += "<td class='labelCol'>Account Site </td>"; output += "td class='dataCol'>" + Account.Site + "</td>"; output += "</tr></table>"; output += "</div></div></div><div class='pbFooter secondaryPalette'><div class='bg'/></div></div>'; document.body.innerHTML += output; } catch (e) { document.body.innerHTML += "Error retrieving candidate information"; document.body.innerHTML += "<br>Fault code: " + e.faultcode; document.body.innerHTML += "<br>Fault string: " + e.faultstring; } } </script> </head> <body class="custom customTab79 detailPage" onload="initPage();"> <div id="mainbody"></div> </body> </html>
any nudge in the right direction would be much appreciated
If you do an alert on record.Site, is it available?
This part below also looks wrong to me - you never actually retrieved the Account name in the original call, so you can't display it - and I think it would be record.Name if you did. And in in the second section, you say Account.Site - that should be record.Site I think.
Code:
Code:
As BritishBoyinDC mentioned, you should probably go with record.Name and record.Site. Also, you may have to adjust the hyperlink "https://na2.salesforce.com" to match your instance.
In addition to the multitudes of syntax errors I wasn't calling AccountId into the global variable.
Thank you both very much.