Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime Error - Invalid conversion from runtime type Map<Id,SObject> to Map<Id,Opportunity> #49

Closed
maniscoursera opened this issue Mar 29, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation
Projects

Comments

@maniscoursera
Copy link

maniscoursera commented Mar 29, 2022

Getting the error at the below line of code -

Code:
Map<Id, Opportunity> oldOppMap = (Map<Id, Opportunity>)args.oldRecordsMap;

Error:
rflib_TriggerManager|run: Handler "OpportunityTriggerHandler" threw an exception with message "Invalid conversion from runtime type Map<Id,SObject> to Map<Id,Opportunity>". Stacktrace:

@maniscoursera
Copy link
Author

Was able to use the oldmap using below code snippet -

Map<Id, sObject> oldOppMap = (Map<Id, sObject>)args.oldRecordsMap;

inside iteration getting the old values as-
Opportunity oppOld = (Opportunity)oldOppMap.get(opp.Id);

@j-fischer j-fischer added the documentation Improvements or additions to documentation label May 3, 2022
@j-fischer j-fischer added this to To Do in RFLIB-TF via automation May 3, 2022
@j-fischer j-fischer moved this from To Do to Done in RFLIB-TF Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

No branches or pull requests

2 participants