Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Looked to do something smart and immediately ran into problems. I thought I will trim the page layouts by using record types. For that I need to run a batch (or data loader), but problem I get an error mentioned in title.

Now I am not exactly sure how Execute Anonymous works but the name implies that it indeed could be related to permissions. Although I found there was a bug previously, but it is now marked as fixed.

Here's my code:

list <Line_del__c> linesToUpdate = [select id from Line_del__c where'BOPS'];
RecordType rtype = [Select id From RecordType Where SobjectType = 'Line_del__c' and name='office' limit 1]; 

for (Line_del__c lines: linesToUpdate){;

update linesToUpdate;
} catch (DmlException ex){

As a side note - can I disable record types? Users now cannot edit their items from a list view. If I would update the record types I could enter them as a criteria into list view filter.


share|improve this question
Execute Anonymous doesn't run code 'anonymously', it runs as the currently connected user, which is you, with all of your Profile & Permission Set granted privileges. – Mark Pond May 15 '14 at 17:12
up vote 7 down vote accepted

1) Check if the recordtype is active

2) See if the profile of the user editing the record has access to the recordtype

Go to Setup --> Administration Setup --> Profiles ( Search for the users profile ) and search for Custom Record Type Settings on the page and check if the "Office" record type is available for the users profile

share|improve this answer
Yes, the record type wasn't set active for the profiles. Couldn't figure it out until started some URL hacking. Created a second record type. Thanks. – dzh May 15 '14 at 17:19

Is it possible that you have an inactive record type named "office"?

The bug you listed was related to person accounts which does not apply to your issue given the object type.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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