You need to sign in to do that
Don't have an account?
Cameron Seitz
Updating Record Fields - Variable Does Not Exist Error
I currently am working on creating an Apex Class that initiially pulls a specific set of Placements (jstcl__Placement__c) and puts them in a list.
It then takes that list of Placement Ojects and edits a relevant field called TimecardEnddateAudit__c field. I keep getting errors saying that the field jstcl__Timesheet_Period__c that exists in some of my if logic does not exist. Logically it should edit fields according to the logic:" If the jstcl__Timesheet_Period__c field is equal to 'Weekly Split' then add .5, else add 1.
It then takes that list of Placement Ojects and edits a relevant field called TimecardEnddateAudit__c field. I keep getting errors saying that the field jstcl__Timesheet_Period__c that exists in some of my if logic does not exist. Logically it should edit fields according to the logic:" If the jstcl__Timesheet_Period__c field is equal to 'Weekly Split' then add .5, else add 1.
public class CamstimecardEndDateAudit{ public static void auditTimeCards(){ List<sObject> placements = [SELECT jstcl__Placement__r.Name FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c IN ('Active') AND jstcl__Week_Ending__c = LAST_N_DAYS:15 AND jstcl__Status__c = 'Pending']; for(List<sObject> A : placements){ if(A.jstcl__Timesheet_Period__c = 'Weekly Split'){ TimecardEndDateAudit__c = TimecardEndDateAudit__c + 0.5;} else{ TimecardEndDateAudit__c = TimecardEndDateAudit__c ++; } } }}
Update the SOQL If you still want to use List<sobject> see https://developer.salesforce.com/forums/?id=906F00000008waAIAQ for other ways to query what you need.