• nitr0gen
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I need to be able to set a flag when an opportunity is saved... The flag will remain false until the opportunity stage is "Closed Won". Although I can implement this using workflow, changing business processes have made the task a bit more challenging and I will need the added functionality of APEX.
 
This is what I have so far:
 
Code:
trigger closedWonTrigger on Opportunity bulk (after update) {
 Opportunity c = [select StageName from Opportunity];
  if (c.StageName == 'Closed Won') {
   c.Closed_Won__c = true;
   update c;
  }
}

 
 This compiles without errors, but I get runtime errors of:
 
"maximum trigger depth exceeded Opportunity trigger event" or "System.QueryException: Array has more than 1 row for assignment to SObject"
 
I'm fairly new to APEX, but something about working with AJAX in the past tells me I'm missing the opportunity id somewhere?
Hi
I wonder if anyone can help me with this problem.
I created a new Custom Link Button with the List Button Display Type.
In the List View this new Button is showing after I have added it to the List View
Now I would like to place this Button on the Related List as well but when I double clicked on the Related List item in the Object , I could only see the Columns and Standard Buttons but not the Custom buttons. So I dont know how to put this button on the Related List item. Does anyone have this problem before and if so, how do we get the new Custom Button to appear in the Related List edit function?
Any pointer will be highly appreciated
Thanks in advance
SL
I need to be able to set a flag when an opportunity is saved... The flag will remain false until the opportunity stage is "Closed Won". Although I can implement this using workflow, changing business processes have made the task a bit more challenging and I will need the added functionality of APEX.
 
This is what I have so far:
 
Code:
trigger closedWonTrigger on Opportunity bulk (after update) {
 Opportunity c = [select StageName from Opportunity];
  if (c.StageName == 'Closed Won') {
   c.Closed_Won__c = true;
   update c;
  }
}

 
 This compiles without errors, but I get runtime errors of:
 
"maximum trigger depth exceeded Opportunity trigger event" or "System.QueryException: Array has more than 1 row for assignment to SObject"
 
I'm fairly new to APEX, but something about working with AJAX in the past tells me I'm missing the opportunity id somewhere?