Skip to main content
2 of 3
added 130 characters in body

Code refactoring of parameter passed Person Account

Anyone know a better way to refactor this code so it won't be hardcoded PersonAccount? Instead, it should be parameter passed in?

String personAccRecTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('PersonAccount').getRecordTypeId();

I have read this blog and with a SOQL query might work but I am still thinking if there is a better approach that won't break? http://smukov.github.io/blog/2018/06/09/Record-Type-Id-By-Developer-Name/

Thanks, Darko