• AndySF
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Hi all,

 

I'm trying to write my first trigger and am running into some errors.  It is probably baby stuff, but we all have to start somewhere.  Can someone please help with the error?

 

I'm trying to pull a field (text) from the Associated Account to a separate field (picklist) on the Opportunity.

 

Thanks for the help/lesson in advance!

 

 

trigger setXCenter on Opportunity (before insert, before update) { for(Opportunity oppObject : trigger.new) { Account acctObject = [Select Default_X_Center__c from Account where id = :oppObj.Account]; oppObject.Cost_Center__c = acctObject.Default_X_Center__c; }

 I'm getting this error:

 

 Error: Compile Error: No such column 'Default_X_Center__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 19 column 29

 

Thanks 

 

  • March 08, 2010
  • Like
  • 0
Hi all,

So here's what we are trying to implement.  We want to have a custom field on the Account object which will either say "lost" "cold" "new" or "current", based on opportunity activity for that account.  The criteria would be as follows:

  • if the account was active two years ago, but has had no activity since, the account would be "lost"
  • if the account was active one year ago, but not active this year, the account would be "cold"
  • if the account was created this year, the account would be "new"
  • if the account had activity last year and this year, the account would be "current"
So we thought we could do this based on the opportunity activity.  We would make a new field on the opportunity called current_year_amount and populate it using this formula:

IF(
    AND(
        YEAR(CloseDate) =  YEAR(Today()),
         ISPICKVAL(StageName, "Booked" )
             )
    Amount, 0
)

Then the idea would be to roll up these amounts using a roll up field on the Account level. (We would have separate fields for each scenario, this one would be for current year amount - last year would be YEAR(Today()) -1 and etc)  However, it came to our attention that you cannot reference today() in a roll up field.  To try to skirt this issue, we created another custom field on the opportunity level, which is a currency field, whose default value would be the result of current_year_amount.  This too failed, as I believe it still references the today() function.  Does anyone have any good ideas of how to accomplish what we want to do above sans this forumula field?  Is there a way around this?  Do we have to look outside of roll ups?

Any help is greatly appreciated.  I think others would be able to benefit from something like this as well...an "account status" field which shows the health of an account right on the page.  We are not looking to do this from reporting, but from the SF interface.

Thanks in advance for any help,
Andrew




Message Edited by AndySF on 04-14-2008 12:16 PM
  • April 14, 2008
  • Like
  • 0
 
I added a custom lookup field to the Lead object that references
Account. When I use the query wizard in the connector it does not show
up in the column list. It shows up fine in the UI and in a call to
DescribeSObject. Another simple Text field I added shows up just fine
in the connector.
The same issue occurs in the import wizard. My lookup field does not
show up in the custom field section of the mapping page but the other
field does. This makes me think I've hit some limitation, but I
haven't found an explanation anywhere yet.