function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

S-Control Image Field

I have a field on the Contact record that I need to determine the Support Status of, and display a red stoplight or green stoplight based on that status. Normally, I'd use a formula field, but in this case the field I'm querying off of isn't located on the Contact record, but rather on the Account parent record. I've coded some logic into an S-control, and the actual image displays properly.

The problem is that the field is ballooned to a rather unacceptable degree. Furthermore, I cannot get the field name to center properly, nor can I get it to look like the rest of the fields.

Any advice would be greatly appreciated.

<script src="/soap/ajax/9.0/connection.js"></script>

<script language="javascript">
function init()

var resAc = sforce.connection.query("SELECT Account.Id FROM Contact WHERE Id = '{!Contact.Id}'")
if(resAc.records != null && resAc.records.Account != null)

var AcId = resAc.records.Account.Id

var res = sforce.connection.query("SELECT Support_Status__c FROM Account WHERE Id = '"+AcId+"'")
if(res.getArray('records')[0].get('Support_Status__c') != null)

if(res.getArray('records')[0].get('Support_Status__c') == 'Support Open')



<body onLoad='init()'>

Support Status: <img id='Green' src=''></img>



You can resize the s-control on the page layout by double-clicking on it. The default is 100, try a value around 2 pixels taller than your image. Or, you can dynamically resize it (I think I've reposted that code enough this month). Either way, it doesn't need to be huge.