• chithra srinivasan
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Hi,
  Tried to solve the challenge, "Create a Mobile Friendly Visualforce Page Using Bootstrap" but found that the standard list controller is not working. Used standardController="Contact" and recordSetVar="contacts" and not getting the contacts inside the <apex:repaeat> iteration component. Any help is appreciated.

Thanks,
Chithra
Hi,
     Need help in this Closed Opportunity -Trigger Bulk Apex trigger trail head challenge.The following error was received when trying to check the challenge eventhough the code worked and desired result was achieved. Could not check the challenge.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClosedOpportunityTrigger: execution of AfterInsert caused by: System.ListException: Before Insert or Upsert list must not have two identically equal elements Trigger.ClosedOpportunityTrigger: line 19, column 1: []

The code is given below.
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
    try {
          List<Opportunity> Opps = [SELECT Id, StageName FROM Opportunity 
             WHERE StageName =:'Closed Won' AND Id IN :Trigger.New];
    
           List<Task> tasks = new List<Task>();
           Task t = new Task();

           for(Opportunity opp : Opps) {
               if(Trigger.isInsert || Trigger.isUpdate) {
                t.Subject = 'Follow Up Test Task';
                t.WhatId = opp.Id;
                tasks.add(t);
           
              }   
           }
           System.debug(tasks.size() + '  tasks size');
           if(tasks.size() > 0) {  
            upsert tasks;
           }    
       }catch (DmlException e) {
        System.debug('A DML exception has occurred: ' +
                    e.getMessage());
    }         
}
Thanks,
Chithra

 
Hi,
   I am trying out the Closed Opportunity Trigger Challenge in Bulk  Apex Trigger Trailhead. I am getting the error : " System.QueryException: List has more than 1 row for assignment to SObject" when I perfomed the Execute Anonymous. Eventhough I could make the code more efficient, would like to know the cause of the error. Any help is appreciated and here is the code:

trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
    try {
         List<Opportunity> Opps = [SELECT Id,StageName FROM Opportunity
          WHERE Id IN :Trigger.New];
       
   List<Task> tasks = new List<Task>();

    Task t = new Task();
        for(integer i=0; i<Opps.size(); i++) {
          if(Trigger.isInsert || Trigger.isUpdate) {
            if (Opps[i].StageName == 'Closed Won'){

                t.Subject = 'Follow Up Test Task';
                t.WhatId = Opps[i].Id;
                tasks.add(t);
                                
            }
          }   
        }
    System.debug(tasks.size() + '  tasks size');
     if(tasks.size() > 0) {  
      insert tasks;
     }    
    }catch (DmlException e) {
        System.debug('A DML exception has occurred: ' +
                    e.getMessage());
    } 
   
}
Hi,
    Eventhough my code works i still get the error "The page does not bind to the record ID value (in order to link to the record detail page) " when i tried to check in the challenge. any help is appreciated.
code below:
<apex:page standardController="Account" recordSetVar="accounts" >
   <apex:pageBlock title="Account List">
      <!-- accounts List -->
       <apex:repeat value="{! accounts }" var="a">
          <li>
            <apex:outputLink value="/{!LEFT(a.Id,15)}">/{!LEFT(a.Id,15)} </apex:outputLink>
          </li>
</apex:repeat>
</apex:pageBlock>
</apex:page>

Thanks
Hi,
  Tried to solve the challenge, "Create a Mobile Friendly Visualforce Page Using Bootstrap" but found that the standard list controller is not working. Used standardController="Contact" and recordSetVar="contacts" and not getting the contacts inside the <apex:repaeat> iteration component. Any help is appreciated.

Thanks,
Chithra
Hi,
     Need help in this Closed Opportunity -Trigger Bulk Apex trigger trail head challenge.The following error was received when trying to check the challenge eventhough the code worked and desired result was achieved. Could not check the challenge.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ClosedOpportunityTrigger: execution of AfterInsert caused by: System.ListException: Before Insert or Upsert list must not have two identically equal elements Trigger.ClosedOpportunityTrigger: line 19, column 1: []

The code is given below.
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
    try {
          List<Opportunity> Opps = [SELECT Id, StageName FROM Opportunity 
             WHERE StageName =:'Closed Won' AND Id IN :Trigger.New];
    
           List<Task> tasks = new List<Task>();
           Task t = new Task();

           for(Opportunity opp : Opps) {
               if(Trigger.isInsert || Trigger.isUpdate) {
                t.Subject = 'Follow Up Test Task';
                t.WhatId = opp.Id;
                tasks.add(t);
           
              }   
           }
           System.debug(tasks.size() + '  tasks size');
           if(tasks.size() > 0) {  
            upsert tasks;
           }    
       }catch (DmlException e) {
        System.debug('A DML exception has occurred: ' +
                    e.getMessage());
    }         
}
Thanks,
Chithra

 
Hi,
   I am trying out the Closed Opportunity Trigger Challenge in Bulk  Apex Trigger Trailhead. I am getting the error : " System.QueryException: List has more than 1 row for assignment to SObject" when I perfomed the Execute Anonymous. Eventhough I could make the code more efficient, would like to know the cause of the error. Any help is appreciated and here is the code:

trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
    try {
         List<Opportunity> Opps = [SELECT Id,StageName FROM Opportunity
          WHERE Id IN :Trigger.New];
       
   List<Task> tasks = new List<Task>();

    Task t = new Task();
        for(integer i=0; i<Opps.size(); i++) {
          if(Trigger.isInsert || Trigger.isUpdate) {
            if (Opps[i].StageName == 'Closed Won'){

                t.Subject = 'Follow Up Test Task';
                t.WhatId = Opps[i].Id;
                tasks.add(t);
                                
            }
          }   
        }
    System.debug(tasks.size() + '  tasks size');
     if(tasks.size() > 0) {  
      insert tasks;
     }    
    }catch (DmlException e) {
        System.debug('A DML exception has occurred: ' +
                    e.getMessage());
    } 
   
}
Hi,
    Eventhough my code works i still get the error "The page does not bind to the record ID value (in order to link to the record detail page) " when i tried to check in the challenge. any help is appreciated.
code below:
<apex:page standardController="Account" recordSetVar="accounts" >
   <apex:pageBlock title="Account List">
      <!-- accounts List -->
       <apex:repeat value="{! accounts }" var="a">
          <li>
            <apex:outputLink value="/{!LEFT(a.Id,15)}">/{!LEFT(a.Id,15)} </apex:outputLink>
          </li>
</apex:repeat>
</apex:pageBlock>
</apex:page>

Thanks