• NRD 4 U
  • 40 Points
  • Member since 2017
  • SSE

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 16

Hi All, 

I am trying to get used to writing triggers doing a fairly simple trigger but I am stuck. 

I am trying to write a trigger where te scenario is:

  1.  Two objects Account and Opportunity
  2. Account field Renewal Term (Renewal_Term__c)that is picklist of years annual through sexennial
  3. Opportunity Field Contract Length ( Contract_Length__c ) that is a picklist of values 1-6
  4. I believe that there is a master-detail relationship between Account and Opportunity
  5. When an Opportunity is Closed Won, Renewal Term should update to the corresponding contract length from the Opportunity, provided that Renewal Term isn't already populated. 

Embarrassingly, all I have so far is:



trigger updatelength on Account (after update) {
    Opportunity__c[] opptoupdate = new Opporunity__c[]{};
        for(account c: trigger.new){
            for(Opportunity__c cp: [select id,name,Contract_Length__c from Opportunity__c where Account = :c.id]{


Would anyone mind helping me out?



I want to ensure that I am reviewing this accurately. https://help.salesforce.com/articleView?id=Hyperlink-Formula-Fields-for-JavaScript-Disablement&language=en_US&type=1

Is there a way to report on all the formula fields and what the formulas are so that I can search to see if my org is affected by this change?

I don't believe that we will be affected, but I want to do my due diligence, so any help in how I should go about this would be greatly appreciated!

Hello -

I have the field update set to update the Type to Customer, if the process is approved. However, I'm getting the following error. I believe I'm getting this incorrectly.. please advise..  "The process did not set the correct Type value when approval outcome is Approved"
Hi all,

My customer is looking to use records as inventory (for lack of a better word) where you could only have a lookup record be only used once (could not use that record twice in two different Opportunities in the specific Lookup field). What is the best way to do this inside Salesforce?


I am using Data Loader to import records from on old SF system to a new one. I am familiar with the nature of the Invalid Cross Reference id error and the reasons for it however I don't understand why I am getting this error with the upload of data into the opportunity object/table. 1/2 of the records upload successfully but 1/2 dont.

I have checked the ID fields that I use in the data upload (ie RecordTypeID, PriceBookID, AccountID, etc) and I cannot see an obvious trend with the rejected records compared to the successful ones. The AccountIDs are new and valid and as for the other ID fields, I can see examples of them in the 'success' records as well as the error records, so the ID values cant be invalid if they worked for numerous other records. The only ID field that can be considered unique is the AccountID which I am associating these payment (opportunity) records with but they are all AccountIDs from the new SF system which I have linked to using vlookup in excel. If they were invalid then all the upload records should be invalid not just half of them.

Does anyone have any idea why this error is occurring on half my opportunity upload records?
any advice is much appreciated.

I am tyring to build a process that will count the number of opportunities in a particular stage and based upon results will determine with picklist value on the account page will have.  Example
Opportunity Status is set to Status 1.  update Opportunity 2 to a higher status, it would change the account picklist value.  If that same opportunity were to be lost it would then lower the account field.  Then if the 1st opportunity also loses it would then change the account picklist field again.  Basisally which ever has the highest opportunity status between creating opportunity, higher statuses or lost would determine with value it is.  

Any thoughts.