I hope you can help me with my problem. I am trying to update a record with Apex Code using the workbench. The Code compiles and so I thought it is fine. The code updares the wrongly set record type to the correct one. But when I look into the record then in Salesforce it is still showing the old one, so no update did happen... Any ideas?

The code is

    List<Quote> cnts = [SELECT Id FROM Quote WHERE Id = '012D00000003EnX'];
for(Quote c : cnts){
c.RecordTypeId = '012D00000003EnX';
update cnts;

and the result is

    Execute Anonymous: List<Quote> cnts = [SELECT Id FROM Quote WHERE Id = '012D00000003EnX'];
Execute Anonymous: for(Quote c : cnts){
Execute Anonymous: c.RecordTypeId = '012D00000003EnX';
Execute Anonymous: }
Execute Anonymous: update cnts;
11:02:34.036 (36889804)|EXECUTION_STARTED
11:02:34.036 (36921042)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
11:02:34.060 (60446480)|CODE_UNIT_FINISHED|execute_anonymous_apex
11:02:34.061 (61663989)|EXECUTION_FINISHED

but when I open up the Quote it has still the old record type....



Check your code you are updating Quotes to the exact same record type as the one queried. 012D00000003EnX

  • Ahhh! Thank you so much! Sitting in fron of APEX Code too long now! Thanks for the hint! – David Aug 10 '15 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.