You need to sign in to do that
Don't have an account?
gmc74
How do I add an If statement to this S-Control?
I have a simple S-Control that shows some HTML on a screen. I want to add an if statement to this where if the value returned is 'In Office' (with out quotes of course) then run as it is, if it is anything else, then I want to change the color of the font. I know the HTML, but I can't get the if statement to work. Any ideas?
Code:
<html> <head> <script src="/soap/ajax/10.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 Support_In_Out__c FROM User where ID = '{!Case.Route_To_UserId__c}'", callback); } function displayResult(result) { var it = new sforce.QueryResultIterator(result); var html = []; while(it.hasNext()) { var record = it.next(); html.push("<td> This Account Manager is listed as <b>" + record.Support_In_Out__c + "</b></td>"); html.push("</tr>"); } 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.push("</tr>");
Message Edited by Whyser on 06-02-2008 11:05 AM
If it is anything else, then this line
or you can do it the other way I showed
tempHTML += "This Account Manager is listed as <b>" + record.Support_In_Out__c + "</b></td>";
html.push( tempHTML );
The "if" statement I showed you is a short form method. The syntax is
Message Edited by Whyser on 06-02-2008 01:59 PM
Tried the first method -
Both In Office and Out of Office showed up in Black
The second option worked, thank you for the help. I am not sure what the heck I did originally, I thought I had done it just like that but it didn't work. Oh well, thanks for the assistance!