You need to sign in to do that
Don't have an account?
Luke Higgins 23
I am trying to update a custom number field of a list of custom objects
I am trying to update a custom number field of a list of custom objects. I keep receiving the error Error: Compile Error: Field is not writeable: jstcl__TG_Timesheet__c.Period__c at line 12 column 22. However, this varible isn't the one being written over, I'm just reading what it's value is on the if statement.
This is what I have so far:
This is what I have so far:
public class CamstimecardEndDateAudit{ public static void auditTimeCards(){ List<jstcl__TG_Timesheet__c> myList = new List<jstcl__TG_Timesheet__c>(); myList = [SELECT jstcl__Placement__r.Name, Period__c, TCEndDateAuditB__c 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(integer i=0 ; i < myList.size(); i++) { if(myList[i].Period__c = 'Weekly Split'){ myList[i].TCEndDateAuditB__c = myList[i].TCEndDateAuditB__c + 0.5;} else{ myList[i].TCEndDateAuditB__c = myList[i].TCEndDateAuditB__c + 1; } } update myList; }}
Best Answer chosen by Luke Higgins 23
Pradeep Singh
Hi, modify your if statement to IF(myList[i].Period__c == 'Weekly Split')