You need to sign in to do that
Don't have an account?
Ab
Changing record type for many records based on related to field
Hello,
I have exsisting Account and opportunities records.
They have Tasks related to it.
Task have record type TA, TB, TC
I want to replace all the TA related to Accounts with TB
and I want to replace all the TA related to opportunites with TC.
I am planning to run a code in Anonymous mode in Production,
Thank you for advise.
I have exsisting Account and opportunities records.
They have Tasks related to it.
Task have record type TA, TB, TC
I want to replace all the TA related to Accounts with TB
and I want to replace all the TA related to opportunites with TC.
I am planning to run a code in Anonymous mode in Production,
Thank you for advise.
id recordTypeIdTA = Schema.SObjectType.Account.getRecordTypeInfosByName().get('TA').getRecordTypeId();
id recordTypeIdTB = Schema.SObjectType.Account.getRecordTypeInfosByName().get('TB').getRecordTypeId();
list<account> Accs = [select id,RecordTypeid from account where recordtypeid = :recordTypeIdTA ]; //may subject to soql governor limit
foreach(Account a : Accs)
a.recordtypeid = recordTypeIdTB;
update Accs;