• Luik Lara
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
Hi! I am very new to triggers and can not figure out what is wrong with this. I am receiving this error: Error: Compile Error: Invalid type: ActivityUtils at line 8 column 5 when trying to add a trigger to the task object that will allow my custom field (on the lead) to count how many closed tasks there are.

trigger NVMTaskTrigger on Task (after insert, after update, after delete, after undelete) {
    
    sObject[] triggerRecords;
    if(!trigger.isDelete) triggerRecords = trigger.new;
    else triggerRecords = trigger.old;
    
    //Update Open Activity Count
    ActivityUtils au = new ActivityUtils(triggerRecords);
    au.updateAccountActivityCount();
    au.updateContactActivityCount();
    au.updateLeadActivityCount();
    au.updateOpportunityActivityCount();
    au.updateCaseActivityCount();
}
Hello everyone!

I have been fighting with this for a few days now so I thought I would post here to see if anyone can assist. 

I am trying to create a simple VF page on the contact level that has two action buttons that create a record. I have already created the actions on the contact level (Rewards_list_for_rewards_received_list & Brand_Activites). Then I wanted to show a list of the completed events but I only want to show the actions from those two buttons, not all history. 

Is this possible? Would appreciate any assistance. 

Thanks!
Hello everyone!

I am using apex:commandLink for a VF list page but it is opening the wrong edit page. The edit button is currently opening the edit opportunity product details and I need it to open the Product Line Item schedules instead (this page: /related/OpportunityLineItemSchedules/view). I have tried using different actions, a custom URL, and a ton of other options but I can't get anything to work. Does anyone have an answer? 

Thanks! 

VF page with the button: 
User-added image
Current Code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
 <apex:form >
     <apex:pageBlock >
     <apex:pageBlockTable value="{!lstOLIS}" var="lst" >
          <apex:column headerValue="Product" value="{!lst.OpportunityLineItem.Product2Id}"/>
          <apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
          <apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
         <apex:column ><apex:commandLink action="{!edit}" value="Edit" id="EstablishOpportunityLineItemSchedules"/></apex:column>
     </apex:pageBlockTable>
     </apex:pageBlock>
 </apex:form>
</apex:page>
 
public with sharing class OpportunityScheduleExtension {
    Opportunity objOpp;
    public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
    public OpportunityScheduleExtension(ApexPages.StandardController controller) {
        this.objOpp= (Opportunity)controller.getRecord();
    }
    
   
    public void getOLIS(){
        lstOLIS = new list<OpportunityLineItemSchedule >();
        system.debug('objOpp---------->'+objOpp);
        for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
                                                 OpportunityLineItem.Product2.Name,
                                                 Description,Product_Name2__c, NAME__c
                                                 from OpportunityLineItemSchedule 
                                                 where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
            lstOLIS.add(objOLIS);                                             
        }
    }    
}

 
Hello!

I have been trying to solve this for ages and can not figure it out (I am not a developer). 
User-added image
I modified someone else's code to build a visualforce page to show product revenue schedules (above). Instead of the 'Edit Schedule' button, I am trying to show that smaller down carrot icon that reps can select to then click 'edit'. In addition, the current button shows the edit product page instead of the edit revenue schedule page. Can someone please advise? 

Here is the code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
 <apex:form >
     <apex:pageBlock >
     <apex:pageBlockTable value="{!lstOLIS}" var="lst" >
          <apex:column headerValue="Product" value="{!lst.Product_Name2__c}"/>
          <apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
          <apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
          <apex:column ><apex:commandButton action="{!edit}" value="Edit Schedule" id="OpportunityLineItemScheduleMultiEdit"/></apex:column>
     </apex:pageBlockTable>
     </apex:pageBlock>
 </apex:form>
</apex:page>

Extension: 
public with sharing class OpportunityScheduleExtension {
    Opportunity objOpp;
    public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
    public OpportunityScheduleExtension(ApexPages.StandardController controller) {
        this.objOpp= (Opportunity)controller.getRecord();
    }
    
   
    public void getOLIS(){
        lstOLIS = new list<OpportunityLineItemSchedule >();
        system.debug('objOpp---------->'+objOpp);
        for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
                                                 OpportunityLineItem.Product2.Name,
                                                 Description,Product_Name2__c
                                                 from OpportunityLineItemSchedule 
                                                 where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
            lstOLIS.add(objOLIS);                                             
        }
    }    
}
Hello everyone!

I am using apex:commandLink for a VF list page but it is opening the wrong edit page. The edit button is currently opening the edit opportunity product details and I need it to open the Product Line Item schedules instead (this page: /related/OpportunityLineItemSchedules/view). I have tried using different actions, a custom URL, and a ton of other options but I can't get anything to work. Does anyone have an answer? 

Thanks! 

VF page with the button: 
User-added image
Current Code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
 <apex:form >
     <apex:pageBlock >
     <apex:pageBlockTable value="{!lstOLIS}" var="lst" >
          <apex:column headerValue="Product" value="{!lst.OpportunityLineItem.Product2Id}"/>
          <apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
          <apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
         <apex:column ><apex:commandLink action="{!edit}" value="Edit" id="EstablishOpportunityLineItemSchedules"/></apex:column>
     </apex:pageBlockTable>
     </apex:pageBlock>
 </apex:form>
</apex:page>
 
public with sharing class OpportunityScheduleExtension {
    Opportunity objOpp;
    public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
    public OpportunityScheduleExtension(ApexPages.StandardController controller) {
        this.objOpp= (Opportunity)controller.getRecord();
    }
    
   
    public void getOLIS(){
        lstOLIS = new list<OpportunityLineItemSchedule >();
        system.debug('objOpp---------->'+objOpp);
        for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
                                                 OpportunityLineItem.Product2.Name,
                                                 Description,Product_Name2__c, NAME__c
                                                 from OpportunityLineItemSchedule 
                                                 where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
            lstOLIS.add(objOLIS);                                             
        }
    }    
}

 
Hello!

I have been trying to solve this for ages and can not figure it out (I am not a developer). 
User-added image
I modified someone else's code to build a visualforce page to show product revenue schedules (above). Instead of the 'Edit Schedule' button, I am trying to show that smaller down carrot icon that reps can select to then click 'edit'. In addition, the current button shows the edit product page instead of the edit revenue schedule page. Can someone please advise? 

Here is the code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
 <apex:form >
     <apex:pageBlock >
     <apex:pageBlockTable value="{!lstOLIS}" var="lst" >
          <apex:column headerValue="Product" value="{!lst.Product_Name2__c}"/>
          <apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
          <apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
          <apex:column ><apex:commandButton action="{!edit}" value="Edit Schedule" id="OpportunityLineItemScheduleMultiEdit"/></apex:column>
     </apex:pageBlockTable>
     </apex:pageBlock>
 </apex:form>
</apex:page>

Extension: 
public with sharing class OpportunityScheduleExtension {
    Opportunity objOpp;
    public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
    public OpportunityScheduleExtension(ApexPages.StandardController controller) {
        this.objOpp= (Opportunity)controller.getRecord();
    }
    
   
    public void getOLIS(){
        lstOLIS = new list<OpportunityLineItemSchedule >();
        system.debug('objOpp---------->'+objOpp);
        for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
                                                 OpportunityLineItem.Product2.Name,
                                                 Description,Product_Name2__c
                                                 from OpportunityLineItemSchedule 
                                                 where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
            lstOLIS.add(objOLIS);                                             
        }
    }    
}