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 Team_s_Dept_s_del__r.name='BOPS'];
RecordType rtype = [Select id From RecordType Where SobjectType = 'Line_del__c' and name='office' limit 1];
for (Line_del__c lines: linesToUpdate){
lines.recordtypeid=rtype.id;
}
try{
update linesToUpdate;
} catch (DmlException ex){
system.debug(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.
Thanks