I am new to Salesforce Development, I have tested a similar query to this in a sandbox Org which worked, however when trying to update records in the live Org I am having some issues.
The issue and context is as follows:
I am trying to update the 'Record Type' field of certain Job records through Apex DML. I have opened the Developer Console and run a query:
SELECT Name, GW_Volunteers__Campaign__c, RecordtypeId FROM GW_Volunteers__Volunteer_Job__c WHERE GW_Volunteers__Campaign__c = '7010O000001P2XIQA0' and RecordTypeId = null LIMIT 5
This works fine and will show me the first 5 job records where there is no assigned record type, which is what I want to update.
The problem is when I am opening "execute anonymous" window and entering this code:
GW_Volunteers__Volunteer_Job__c [] bjobs = [
SELECT Name, GW_Volunteers__Campaign__c, RecordTypeId FROM GW_Volunteers__Volunteer_Job__c WHERE GW_Volunteers__Campaign__c = '7010O000001P2XIQA0' and RecordTypeId = null LIMIT 5];
bjobs.RecordTypeId='0120O000000LAY6QAO';
update bjobs;
I keep getting the following error:
Line: 3, Column: 11 Variable does not exist: RecordTypeId
Unless I have missed something very obvious, I cannot figure out why this is happening. Since it recognizes that variable in the query fine and a similar query (where I also updated the RecordTypeId) in the sandbox worked.
Thank you,
YH