• mb_
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
Hey guys,

I am kinda new to APEX triggers and I try to solve the following challange:

I built a trigger which updates 2 fields (integer field and picklist field) depending on 2 other picklist fields. Behind those updated fields are some values like:
if(ScoreAbs <= 21){
                a.ScoreTotal__c = 'Bronze';
            }else if(ScoreAbs > 21 && ScoreAbs <= 28){
                a.ScoreTotal__c = 'Silver';
            }else if(ScoreAbs > 28 && ScoreAbs <= 33){
                a.ScoreTotal__c = 'Gold';
            }else if(ScoreAbs > 33){
                a.ScoreTotal__c = 'Platinum';
            }
"ScoreAbs" is calculated via another method. That trigger works fine and there are no errors in it. Now I need to change values within the above code, e.g.  values like 21, 33, 28 etc...
After I changed those values in the first trigger I want to update all leads (something about 2000) with another trigger. Best way would be to press a button within the lead record view.

Do i need to save all leads to a list via a query first to update them after via "update leadList"? Or what would be the best way to get this problem solved?

Thanks!
Best
 
  • January 13, 2017
  • Like
  • 0
Hey guys,

I am kinda new to APEX triggers and I try to solve the following challange:

I built a trigger which updates 2 fields (integer field and picklist field) depending on 2 other picklist fields. Behind those updated fields are some values like:
if(ScoreAbs <= 21){
                a.ScoreTotal__c = 'Bronze';
            }else if(ScoreAbs > 21 && ScoreAbs <= 28){
                a.ScoreTotal__c = 'Silver';
            }else if(ScoreAbs > 28 && ScoreAbs <= 33){
                a.ScoreTotal__c = 'Gold';
            }else if(ScoreAbs > 33){
                a.ScoreTotal__c = 'Platinum';
            }
"ScoreAbs" is calculated via another method. That trigger works fine and there are no errors in it. Now I need to change values within the above code, e.g.  values like 21, 33, 28 etc...
After I changed those values in the first trigger I want to update all leads (something about 2000) with another trigger. Best way would be to press a button within the lead record view.

Do i need to save all leads to a list via a query first to update them after via "update leadList"? Or what would be the best way to get this problem solved?

Thanks!
Best
 
  • January 13, 2017
  • Like
  • 0