• Frédéric Ronteix
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Dear all ! 

I have troube with my trigger and keep getting "Method does not exist or incorrect signature" . What can I do ?

trigger ContactRelatedOpportunities on Opportunity (after insert, after update) {
     List<Opportunity> Opps = [SELECT Id FROM Opportunity WHERE Opportunity.Id IN :Trigger.New];
        ContactRelatedOppsClass.OpportunitiesUpdates(Opps);  
}

using the following class: 

public class ContactRelatedOppsClass {
    @future
    Public static void OpportunitiesUpdates (List<ID> Opps){
        for (ID a:Opps){
            Opportunity OpportuniteAnalysee = [SELECT ID, Name, iCom_QTC__Contact__c FROM Opportunity WHERE ID =:a];
                Contact ContactAssocie  = [SELECT Id,LatestWonOpp__c,LatestLostOpp__c,NextWonOpp__c,NextOpp__c FROM Contact WHERE Id =:OpportuniteAnalysee.iCom_QTC__Contact__c];
                System.debug(ContactAssocie);
                  
                List <Opportunity> latestWonOpp = [SELECT Id
                                                              FROM Opportunity 
                                                              WHERE (iCom_QTC__Contact__c = :ContactAssocie.ID AND StageName='Demande gagnée' AND Nombre_de_jours_relatif_event__c >= 0) 
                                                              ORDER BY Nombre_de_jours_relatif_event__c 
                                                              LIMIT 1];
                if(latestWonOpp != null && !latestWonOpp.isEmpty()){
                    ContactAssocie.LatestWonOpp__c = latestWonOpp[0].Id;
                } else {
                    ContactAssocie.LatestWonOpp__c = null;
                }
                update ContactAssocie
}}}

Dear all,

I am quite new with Apex and have some trouble with programming two custom fields.

Our Salesforce objects have been reprogrammed by specialized company with whom we are no longer in contact with. And with the reprogramming, Contact an Opportunity no longer have a master detail relationship (so rollups do not work!). However I would like to have 2 custom fields on contact  object: the latest won opportunituty and nex won opportunity. How could I do that? process builder? or Apex? and how? 

Thank you all for your help ! 

Fred

Dear all,

I am quite new with Apex and have some trouble with programming two custom fields.

Our Salesforce objects have been reprogrammed by specialized company with whom we are no longer in contact with. And with the reprogramming, Contact an Opportunity no longer have a master detail relationship (so rollups do not work!). However I would like to have 2 custom fields on contact  object: the latest won opportunituty and nex won opportunity. How could I do that? process builder? or Apex? and how? 

Thank you all for your help ! 

Fred