• TCAdmin
  • 110 Points
  • Member since 2006

  • Chatter
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
  • 291

Hi - I'd really appreciate some direction on a custom code question that should be easy but has me stumped.

On our web to lead forms, I would like to have the form have a check box that is checked to receive more info from my company and if they uncheck it, it would then check the Email Opt Out field on the lead. So it would be reversed, when checked, Email Opt Out is unchecked and vice versa.

Here is the code I have to add the check box:

<td width="182"><input id="emailOptOut" name="emailOptOut" type="checkbox" checked="checked" value="1" /><label for="emailOptOut"><span class="style10">I would like to receive information and news communications from eStara in the future.</span></label></td>

I have tried to change the Value to "0", to "False" and to "No". Is it not possible to do this and if it is possible, how do I need to alter the code to reflect this?

Thanks in advance!


I am doing two things to an Opportunity before saving. I have it currently setup as two triggers but I think that this is probably not the best method. Is it normally best to build only one trigger per object that is triggered on a specific event? One trigger for before update, one for before insert, or one for both before update and before insert?

The reason I'm asking is because I am having issues with order of execution. I will probably need to combine the triggers so that they process only as I want and take out any random issues.
Hello All,

I am having a difficult time understanding some of the testing features and how you would do them in theory. If I create a trigger/class that prevents a record from being save you can do an assert on the failed update/insert. What can you test on if you are doing something other than that? I am not understanding it in my head. If I have a trigger/class that sends out an email when a field gets modified, what would you test on? If you are doing an insert but can't figure out how it could possibly error out, what would the next step be to get your testing requirements?
Hello All,
I have ran in to an issue that I have not been able to resolve. I can build a page that looks almost identical to Salesforce's standard pages in an s-control but have not been able to mimic the lookup fields. I have included a simple s-control that lets the user select an Account from my organization, which is working correctly. What isn't working is the displaying of the lookup icon to the right of the field. If you create an s-control using the code below and then call it within Salesforce, I used it in a custom web tab pointing to the s-control, it does not display the magnifying glass next to the text field. If you run your mouse over the area where the image should be you will see that the function is there but not the image. I am hoping someone more familiar with CSS and mimicking Salesforce will be able to let me know where I'm failing.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta name="Author" content="Chris">
<meta name="Description" content="New Time Form">
<link href="/dCSS/Theme2/default/common.css" type="text/css" rel="stylesheet" />
<link href="/sCSS/12.0/Theme2/allCustom.css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" type="text/css" />
<script src="/soap/ajax/12.0/connection.js" type="text/javascript"></script>
<script type="text/javascript" src="/dJS/en/1196379626000/library.js"></script>
<script src="/static/081407/desktop/desktopAjax.js" type="text/javascript"></script>
<script language="JavaScript1.2" src="/js/functions.js"></script>
<script language="JavaScript">
 function createTest(){
  alert('create stuff here');
 function cancelCreate(){
  alert('cancel stuff here');

<body class="Custom64Tab editPage">
<a name="skiplink"><img src="/s.gif" height='1' width='1' alt="Content Starts Here" class="skiplink"></a>
 <div class="bPageTitle">
  <div class="ptBody secondaryPalette">
   <div class="content">
    <img class="pageTitleIcon" title="Time" alt="Time" src="/s.gif" />
    <h1 class="pageType">
     New Test
     <span class="titleSeparatingColon">:</span>
    <h2 class="pageDescription">Test Edit</h2>
    <div class="blank"></div>
   <div class="links"></div>
  <div class="ptBreadcrumb" />

 <FORM NAME="editPage" ID="editPage">
  <div class="bPageBlock secondaryPalette">
   <div class="pbHeader">
    <table cellspacing="0" cellpadding="0" border="0">
       <td class="pbTitle">
        <img class="minWidth" width="1" height="1" title="" alt="" src="/s.gif" />
        <h2 class="mainTitle">Add Test</h2>
       <td id="topButtonRow" class="pbButton">
        <input value=" Add Test " class="btn" type="button" title="upd" name="upd" onclick="createTest()" >
        <input value=" Cancel " class="btn" type="button" name="done" onclick="cancelCreate()" >
         <span class=errorMsg id="error_General"></span>
   <div class="pbBody">
    <div class="pbSubheader first tertiaryPalette" id="head_1_ep">
     <span class="pbSubExtra">
      <span class="requiredLegend">
       <span class="requiredExampleOuter">
        <span class="requiredExample"></span>
       <span class="requiredText"> = Required Information</span>
     <h3>Test Details<span class="titleSeparatingColon">:</span></h3>
    <div class="pbSubsection">
     <table class="detailList" border="0" cellpadding="0" cellspacing="0">
        <td class="labelCol requiredInput">
         <label for="Account"><span class="requiredMark">*</span>Account</label>
        <td class="dataCol co102">
         <div class="requiredInput">
          <div class="requiredBlock"></div>
          <input id="Account_lkid" type="hidden" value="000000000000000" name="Account_lkid"/>
          <input id="Account_lkold" type="hidden" value="null" name="Account_lkold"/>
          <input id="Account_lktp" type="hidden" value="001" name="Account_lktp"/>
          <input id="Account_lspf" type="hidden" value="0" name="Account_lspf"/>
          <input id="Account_mod" type="hidden" value="0" name="Account_mod"/>
          <span class="lookupInput">
           <input tabindex="1" id="Account" type="text" size="20" name="Account" maxLength="255" onchange="getElementByIdCS('Account_lkid').value='';getElementByIdCS('Account_mod').value='1';" />
           <a id="Account_lkwgt" title="Reports To Lookup (New Window)" tabindex="1" onclick="setLastMousePosition(event)" href="JavaScript&colon; openLookup('/_ui/common/data/LookupPage—lkfm=editPage&lknm=Account&lktp=' + document.getElementById('Account_lktp').value,670,document.getElementById('Account_mod').value,'&lksrch=' + escapeUTF(document.getElementById('Account').value))">
            <img class="lookupIcon" title="Reports To Lookup (New Window)" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onfocus="this.className = 'lookupIconOn';" onblur="this.className = 'lookupIcon';" alt="Reports To Lookup (New Window)" src="/s.gif"/>
            <span class=errorMsg id="error_Account"></span>
        <td class="labelCol">
         <label for="openProject"></label>
        <td class="dataCol">
          <span class=errorMsg id="error_openProject"></span>
   <div class="pbBottomButtons">
    <TABLE cellpadding="0" cellspacing="0" border="0">
       <TD class="pbTitle">
        <img src="/s.gif" alt="" title="" width=1 height=1 class="minWidth">
       <TD class="pbButtonb" id="bottomButtonRow">
        <input value=" Add Test " class="btn" type="button" title="upd" name="upd" onclick="createTest()" >
        <input value=" Cancel " class="btn" type="button" name="done" onclick="cancelCreate()" >
   <div class="pbFooter secondaryPalette">
    <div class="bg"></div>


Message Edited by TCAdmin on 05-21-2008 05:15 PM

I am a Salesforce.com system administrator looking for a remote administrator position or a position in Oregon, Washington, or a Colorado with relocation assistance. I have been doing customer support and administration work for 2+ years and I am the subject matter expert for many of the Salesforce features. I have experience doing the following and more:


  • Daily administration tasks (Reports, Dashboards, Data Cleansing)
  • User maintenance (User Setup, Sharing Model, Sharing Rules, Profile Management)
  • Assignment Rules, Auto-Response Rules
  • Design (Field, Page, Object, Tab) setup
  • Import / Export features
  • Web-to-X setup (Lead, Case, Self-Service Portal)
  • System Extension (Custom s-controls, Validation Rules, Formulas)
  • AppExchange creation and setup
  • Many other aspects of the system used daily


I am looking for a full or part-time position within a company that offers a chance to advance. If you are interested in my services and feel that I would be a good fit for your company then please email me and I will forward my resume to review.


I look forward to hearing from you, Chris.

I have a developer and a production org and I'm trying to migrate my sControl to the production org and I'm having an issue.  In the DE I can do a get on a relationship.  dynaBean.Relationship__r.get("Name") and it works in the DE perfectly.  I am now trying to put the same code into the production org and it doesn't like the syntax and kills the process.  When I alert the results of my query it does give me all the information I need but it just won't allow me to do anything with it after I query.  Is this a known issue?

TIA, Chris.
Hello All,

I've made sControls that trigger with a custom button and have used the following code to refresh the orininal record.  I'm trying to create the same functionality with a custom sControl field so that the user doesn't need to click on the button.  I want the sControl to process the record and update the fields that need to be done.  Once that is done I wan tthe original record view to be refreshed so that the user can see what the new values are.  Is there a way to do this and if so, how?
The code I'm using if the users chooses to use a button to initiate



I’m trying to get the IDs of attachments.  I’m using a query call with “Select n.ParentId, n.Id From NoteAndAttachment n” as the call.  It is giving me an error that says query is not available when using Notes & Attachments.  Is there a work around for this type of request?



I've got this code and I'm trying to do a query of the system using a JS variable as the matching value.  The "id" field is the 18 digit Account Id value.  I'm trying to pull all Opportunities that are associated with the Account with this id.  When I alert the oppValues I get the following values even though I know there are Opportunities associated with the Account Id I'm using.  Can someone give me the syntax that would do what I want?

Query Result [1]:
size: 0
queryLocator: null
done: true
QueryResult [1] ***********************************

var account = accValues.records[cnt];
var id = account.get("Id");
var oppValues = sforceClient.query("SELECT AccountId, Amount FROM Opportunity WHERE AccountId = 'id' ");

 Thanks in advance for any help.

I created an application that includes five custom fields that are on the Account object.  There is one button on the Account object that points to a custom sControl.  The application works on the org that I used to create it, both IE and Firefox.  The application also works in the test drive org that is created for the application.
The issue I'm having is that in two orgs that have installed the application it doesn't work.  The sControl opens another window like it supose to but then it stalls.  Is there a generic issue that is stopping it from working in these orgs?
(All orgs are EE or DE, I know it won't work within a PE since it uses the API)
If someone wants to take a look at it then please email me at tonkac@tonkacruiser.com and I'll email you the link.
I am attempting to create an Opportunity Workflow Rule that will fire when anything changes on the Opportunity Record, including Products.  It is currently set for

"Every time a record is created or edited"

When the Opportunity record is updated or any of the related lists are updated, except Products, the WFR fires as expected.  How do we get the WFR to fire when the Products related is updated?

haven't a clue how to figure out how to write triggers.  none of the examples have enuff explanation to get me going.
i want to write a trigger that does the following:
the trigger needs to fire on update of contacts.Account
it would have to look up the accounts.organization_code__c where accounts.Name=contacts.Account
and make contact.org_code__c =account.organization_code__c
any takers :)
Can anyone help with the code for a new button to override the Account tab New Account button.
I am looking to populate a custom Division list field on the Account with the users division.
I have created a custom object which is related to Account object.
Whenever I want to create the new custom object record I need to insert the acount id also.
But how can I retrieve the current logged in account info or user info.
What I am trying to do is creating a s-control to override the new entry form with our UI and submitting the data to salesforce using salesforce objects.
Thanks in advance.
  • July 02, 2008
  • Like
  • 0

I have a s-control button that creates a new task when clicked. I also want it to auto populate a custom picklist field when the task is created.


The code I have written is below, does anyone know what code I need to include to populate a custom field via this s-control? If this is not possible do you have any other suggestions?








Also, is there any specific reason I would want to do this with apex code rather than an s-control, if so any tips on how to get started. I have yet to implement any serious Apex code.




   We have a client that would like to install the 'Professional Services Automation' app from the AppExchange and have a workflow that creates a new project whenever an opportunity has reached the stage 'Closed Won'.  I have been looking all over for the way to do this but have not come up with a solution.  Does anybody know how a field change on one object can be used to created a new record on a different object type?
Thank you.
Currently we have opportunities divided into two record types - svcs & soft
the svcs opps have the option to link to a soft opp.  The soft opps do not
have the option to link to the svcs opps.
I've been asked for a report, or view that shows all the soft opps with a field indicating
which ones are related to a svcs opp
so far I have not found a way to do that in SFDC.  I can export two reports to Excel and
find the common opps, but haven't been able to do that in SFDC yet.
We have an s-control to override the New button on the Case to pass in some default values from the user record.
It works fine, unless...
the user has multiple record types and they do not want to select the default record type.
ie. user is presented with the select record type page on clicking New
Selects a record type that is NOT the default one
The default loads anyway
The url shows 2 record type ids, first the selected one and then the default one. The default takes precedence.
The field to be updated and values are on both record types.
Any ideas?
  • June 27, 2008
  • Like
  • 0
1. I want to know if this is possible.
I have an account that is a service provider for my company.
on the account page i have a field with a travel rate that the service recieves for his/her travel time.
how do i update the field on the customer object to reflect this travel rate?
2. Does anyone know a formula that will calculate the travel rate based on the service providers account number?
  • June 25, 2008
  • Like
  • 0
I know there is a way to write this and I am just stumped.

I need to update a percentage field as follows:

If the pickval field Business Unit equals X or Y and the pickval field Implementation Type is In-House, then the Rev Rec percent should be 54. If the implementation Type is ASP, the Rev Rec percentage is 0.

If the Business Unit is W or Z and the Implementation Type is In-House, the the Rev Rec percent is 85. If the Implementation Type is ASP, the percentage is zero.

Can someone help me muddle through the and, or and if statements to make this work?

Thanks for any help I can get!

We have created a survey in Custom Objects. One of the questions does not always apply so we leave the answer blank. When we go to average the scores, these are questions where the respondant replies with a rating 1-10, the average includes that question as part of the overall average. To avoid that we thought we could just create a rule in advanced filters
Question 11 not equal to and then we leave the field blank.
It works but it excludes the entire survey. UGH!
Is there a way to exclude the one question if the answer is blank, but include the rest of the questions on the survey?
Thank you!
hi all,

i've recently be assigned the admin role and not sure how to set up a time dependent workflow based on the last activity...

scenerio - when there is no activity at the contact level within 30 days, a custom checkbox at the contact level gets checked off.

can anyone help?  any insight would be greatly appreciated!


Message Edited by ascarl2 on 06-04-2008 05:29 AM
Hello, need some guidance on below...
I've added custom fields to the Opportunity Product details page and these are added to the page layout. Validation rule is also added; if Product A is chosen, then these custom fields need to be completed.
However when I click on Add Products in the Opportunity page and select Product A, these custom fields do not appear for entry (though the error msg is showing up).
Does anyone has a sample S-control to create a page layout that will include those custom fields ... Thanks!
  • April 03, 2008
  • Like
  • 0

I created a List Button :

List Button code :

var recordsToTransfer = {!GetRecordIds($ObjectType.Order__c)}

function init(){
if(recordsToTransfer.length < 1){
alert(" Please Select a value") ;

else if (!document.elementsAddedToPage)
for(var i=0; i < recordsToTransfer.length ; i++) {
function Edit(OrderID){
var Edit = new sforce.SObject("Order__c");
Edit.Id = OrderID;
Edit.Order_Status__c = "Ready";
var result = sforce.connection.update([Edit]);


This code will change the Status of the selected Orders. It works fine But a few times (in I.E. 7.0)  I've got a weird error :

Something like : 'Error On Click Javascript  Sforce is not defined ';

Please, can someone help me on this ? I don't understand this error. (Apparently It's only for some no Admin Profile users... and always in I.E. 7.0 even if I had that error once in firefox in admin profile :s but once I refreshed it was ok) I tryed already to update I.E, but does not work!

Thank you in advance for your help; this is really very important ...


Message Edited by Mig on 02-12-2008 01:13 PM
  • February 12, 2008
  • Like
  • 0
Hi All
I have written a S-control to update a field.
The Problem is 'it is not working for few profiles'. What might be the reason.
Can anyone help in this.
Thanks in Advance