Skip to main content
deleted 18 characters in body; edited tags
Source Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431

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

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

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/

added 130 characters in body
Source Link

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

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();

Thanks, Darko

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

Source Link

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();

Thanks, Darko