You need to sign in to do that
Don't have an account?
idiris Abdukhamitov 1
How to use Trigger.NewMap in the class?
Who can help in this situation?
Class:
public static List<ObjectName> MethosName(Map <Id, objectName> objectNameNewMap){logic}
trigger(beforeUpdate):
Trigger:
List<OnjectName> ObjectNameList = ClassName.methodName(Trigger.newMap);
ERROR:
Method does not exist or incorrect signature: void MethodeName(Map<Id,SObject>) from the type Classname
All Answers
You can take reference from this below code. Maybe this code will help you.
Class:
trigger(beforeUpdate):
Trigger:
In case you find any other issue please mention.
If you find your Solution then mark this as the best answer.
Thanks and Regards
Suraj Tripathi.
Please check the method name. In your sample am seeing the method name declared in class is different from it reffered in trigger.
Class:
public static List<ObjectName> MethosName(Map <Id, objectName> objectNameNewMap){logic} // Here it is MethosName
Trigger:
List<OnjectName> ObjectNameList = ClassName.methodName(Trigger.newMap); // Here it is methodName
If there is no same method name is not found in class also will throw this kind of error.
======================
Class:
public static List<ObjectName> methodName(Map <Id, objectName> objectNameNewMap){logic}
Trigger:
List<OnjectName> ObjectNameList = ClassName.methodName(Trigger.newMap);
=====================
And Method parameter also needs to be same. for example If my trigger.newMap is coming from account trigger means it is Map<Id,Account> so in the class it should be public static List<ObjectName> methodName(Map<Id,Account>> NewMap). So verify you are passing the correct parameter or not.
Thanks,
Maharajan.C
Maharajan C:: Everything is correct. I did a mistake when was writing a question. But in sandbox everything is OK.
Check this code:- Please mark it as best answer if it helps.
Thanks.