• seattle_user
  • NEWBIE
  • 0 Points
  • Member since 2010
  • Business Analyst & Salesforce Adminstrator
  • Bluekai

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Here's a screenshot of what i see in developer console, it's missing executable logs and I don't see the execution logs like in this link http://www.salesforce.com/us/developer/docs/apex_workbook/Content/apex1_2.htmUser-added image
Hi There,

This trigger is suppose to loop through an opportunity's contact roles and concatenate all the roles into a string and put it in the opportunity. The code works but it runs into too many soql queries limit 101.  I think I need to use a map that holds opportunity IDs and contactRolesString but I'm not able to get it working.

Thanks!


_____________________start of trigger code______________

trigger Opt_ContactRoles_REQ on Opportunity (before insert, before update) {

    if(Trigger.isUpdate || Trigger.isInsert) {
      for(Opportunity opt : trigger.new) {
            String s = '';
          
          
            for(OpportunityContactRole ocr: [SELECT role FROM OpportunityContactRole WHERE OpportunityId =: opt.id])
            {  
                if(ocr.role != null) {
                if(! s.contains(ocr.Role)){
                    if(String.isBlank(s))
                    {
                     s = ocr.Role;
                    }else{
                        s = ocr.Role + ', ' + s ;
                    }
                }
                }
              
            } 
           opt.ContactRoles__c = s;
              
        }
    }
}
Here's a screenshot of what i see in developer console, it's missing executable logs and I don't see the execution logs like in this link http://www.salesforce.com/us/developer/docs/apex_workbook/Content/apex1_2.htmUser-added image
Hi There,

This trigger is suppose to loop through an opportunity's contact roles and concatenate all the roles into a string and put it in the opportunity. The code works but it runs into too many soql queries limit 101.  I think I need to use a map that holds opportunity IDs and contactRolesString but I'm not able to get it working.

Thanks!


_____________________start of trigger code______________

trigger Opt_ContactRoles_REQ on Opportunity (before insert, before update) {

    if(Trigger.isUpdate || Trigger.isInsert) {
      for(Opportunity opt : trigger.new) {
            String s = '';
          
          
            for(OpportunityContactRole ocr: [SELECT role FROM OpportunityContactRole WHERE OpportunityId =: opt.id])
            {  
                if(ocr.role != null) {
                if(! s.contains(ocr.Role)){
                    if(String.isBlank(s))
                    {
                     s = ocr.Role;
                    }else{
                        s = ocr.Role + ', ' + s ;
                    }
                }
                }
              
            } 
           opt.ContactRoles__c = s;
              
        }
    }
}

I have been unable to ascertain how to use the Excel Connector to turn 15 character IDs in an Excel spreadsheet into 18 character IDs, which is something I read was possible on a forum post. I've watched the videos and searched the forums. I know the function "FixID" is involved, but I'm unable to make it work. I've installed the toolkit and correctlt installed the connector, but that's as far as I've gotten.

 

Could someone please dumb this down for me with step by step instructions?

  • February 17, 2009
  • Like
  • 0