function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TheReportDoctorTheReportDoctor 

Method does not exist or incorrect signature

I am calling my new method from a trigger and I get the above error.

 

The line calling the method is near the bottom.

 

trigger OpportunityAfterUpdateInsert on Opportunity (after update, after insert) { String status; Integer record = 0; Integer countSteps = 0; for (Opportunity opp: Trigger.new) { String opportunityId = opp.Id; String productId = opp.Product__c; if ((opp.Stage_Of_Install__c =='7 - Pipeline' || opp.Stage_Of_Install__c =='10 - Disconnected' ) && opp.AccountId != null) { List<Provisioning__c> completedTask = [SELECT ID FROM Provisioning__c WHERE Opportunity__c = :opportunityId AND status__c = '3 - Completed']; if (!completedTask.isEmpty()) { opp.AddError('>>>You can not change the product if there are any completed tasks.'); } if (Trigger.isUpdate) { if (Trigger.new[record].Product__c != Trigger.old[record].Product__c) { opp.AddError('You cannot change products on an opportunity in 7 - Pipeline'); } String oldProductId = Trigger.old[record].Product__c; countSteps = [SELECT count() FROM Provisioning__c WHERE Opportunity__c = :opportunityId AND Product__c = :oldProductId ]; } if (countSteps == 0) { List<Provisioning__c> provisioning = [SELECT Account__c FROM Provisioning__c WHERE Opportunity__c = :opportunityId]; try { delete provisioning ; } catch (dmlException de) { for (Integer i = 0; i < de.getNumDml(); i++) { opp.AddError(de.getDmlMessage(i)); } } if (opp.Stage_Of_Install__c =='7 - Pipeline') { List<ProductProcesses__c> provisioningSteps= [SELECT Department__c , Interval__c , PredecessorStep__c , ProcessStep__c , SuccessorStep__c , WorkSteps__c FROM ProductProcesses__c WHERE Product__c = :productId ORDER BY ProcessStep__c]; if (!provisioningSteps.isEmpty()) { for (ProductProcesses__c productStep: provisioningSteps) { if (productStep.PredecessorStep__c == 0 ) { status = '1 - Active Step'; } else { status = '2 - Pending'; } provisioning.add(new Provisioning__c ( Account__c = opp.AccountId , Department__c = productStep.Department__c , Interval__c = productStep.Interval__c , Opportunity__c = opp.Id , PredecessorStep__c = productStep.PredecessorStep__c , ProcessStep__c = productStep.ProcessStep__c , Product__c = opp.Product__c , Status__c = status , SuccessorStep__c = productStep.SuccessorStep__c , WorkSteps__c = productStep.WorkSteps__c)); } try { insert provisioning; } catch (dmlException de) { for (Integer i = 0; i < de.getNumDml(); i++) { opp.AddError(de.getDmlMessage(i)); } } } } else { List<ProductDisconnect__c> disconnectSteps = [SELECT Department__c , Interval__c , PredecessorStep__c , ProcessStep__c , SuccessorStep__c , WorkSteps__c FROM ProductDisconnect__c WHERE Product__c = :productId ORDER BY ProcessStep__c]; if (!disconnectSteps.isEmpty()) { for (ProductDisconnect__c productStep: disconnectSteps ) { if (productStep.PredecessorStep__c == 0 ) { status = '1 - Active Step'; } else { status = '2 - Pending'; } provisioning.add(new Provisioning__c ( Account__c = opp.AccountId , Department__c = productStep.Department__c , Interval__c = productStep.Interval__c , Opportunity__c = opp.Id , PredecessorStep__c = productStep.PredecessorStep__c , ProcessStep__c = productStep.ProcessStep__c , Product__c = opp.Product__c , Status__c = status , SuccessorStep__c = productStep.SuccessorStep__c , WorkSteps__c = productStep.WorkSteps__c)); } try { insert provisioning; } catch (dmlException de) { for (Integer i = 0; i < de.getNumDml(); i++) { opp.AddError(de.getDmlMessage(i)); } } } } provisioning__c firstRec = [SELECT processStep__c , successorStep__c , predecessorStep__c , Est_Start_Date__c , Est_End_Date__c , Id , Opportunity__c FROM provisioning__c WHERE Opportunity__c = :opportunityId AND successorStep__c = 0 ORDER BY processStep__c LIMIT 1 ]; provisioning.updateEstDates(firstRec); } } record ++; } }

 

 

Here is the class and method that I am trying to call:

 

public class provisioning { public static void testme () { //no comment } public static void updateEstDates (provisioning__c currentRecord ){ String opportunityID = currentRecord.Opportunity__c; Double currentSuccessor = currentRecord.processStep__c; String provisioningId = currentRecord.Id; Date maxLastEndDate; List<provisioning__c> steps = [SELECT processStep__c , predecessorStep__c , successorStep__c , Est_Start_Date__c , Est_End_Date__c , Interval__c FROM provisioning__c WHERE successorStep__c >= :currentSuccessor AND Opportunity__c = :opportunityID AND Id != :provisioningId ORDER BY successorStep__c]; for( provisioning__c eachStep: steps) { if (eachStep.successorStep__c != 99 ) { // track the max last date from those who share my successor for(provisioning__c previousStep: steps) { maxLastEndDate= null; if (previousStep.successorStep__c == 0) { maxLastEndDate = system.today(); } else { if (previousStep.successorStep__c == eachStep.processStep__c) { if (maxLastEndDate< previousStep.Est_End_Date__c) { maxLastEndDate= previousStep.Est_End_Date__c; } } } } eachStep.Est_Start_Date__c = maxLastEndDate; // User's should not change Est_End_Dates. Update the Intervals only!! eachStep.Est_End_Date__c = eachStep.Est_Start_Date__c.addDays(Integer.valueOf(eachStep.Interval__c)); } } } }

 

 

Your time and assistance is greatly appreciated.

 

TRD

 

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

I'm guessing this variable declaration is causing your problem:

 

 

List<Provisioning__c> provisioning = [SELECT Account__c FROM Provisioning__c WHERE Opportunity__c = :opportunityId];

 

 

 

All Answers

mtbclimbermtbclimber

I'm guessing this variable declaration is causing your problem:

 

 

List<Provisioning__c> provisioning = [SELECT Account__c FROM Provisioning__c WHERE Opportunity__c = :opportunityId];

 

 

 

This was selected as the best answer
SuperfellSuperfell
You have a variable called provisioning, so it thinks you're trying to call that, and not the provisioning class.
TheReportDoctorTheReportDoctor
Thanks for the help.  Can't see the forest for the trees.