• Cameron Seitz
  • NEWBIE
  • 25 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 10
    Replies
I currently am only able to get 50% coverage on a test class that I am writing for some Batch Apex that I have written. The issue is that there are a number of lookups/relationships between objects when attempting to create the test records. Specifically  I am in a time crunch and the batch class does not edit anything particularly important or detrimental to the record. It only queries some relevant records/stipulations and changes a checkbox field on the jstcl__TG_Timesheet__c object that is there purely for tracking. How would I go about getting full coverage? Whether that's a mock or not I don't mind, I just have to get this pushed to production quickly. Thank you so much in advance. Here is my Batch Apex:
 
global class placementTimecardAuditFlag implements Database.Batchable<sObject>, Database.Stateful {

  List<jstcl__TG_Timesheet__c> query = [SELECT jstcl__Placement__r.Name FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c ='Active' AND jstcl__Placement__r.jstcl__Timesheet_Period__c != 'Weekly Split' AND jstcl__Week_Ending__c = LAST_N_DAYS:15 AND jstcl__Status__c = 'Pending'];
    Set<String> encounteredNames = new Set<String>();
    Set<String> duplicateNames = new Set<String>();

global Database.QueryLocator start(Database.BatchableContext bc) {
        for(jstcl__TG_Timesheet__c item : query){
    if(encounteredNames.contains(item.jstcl__Placement__r.Name)){
        duplicateNames.add(item.jstcl__Placement__r.Name);
    }
    else{encounteredNames.add(item.jstcl__Placement__r.Name);}
    }
      return Database.getQueryLocator('SELECT Id,Checkbox1__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.Name IN :duplicateNames');}
      

 global void execute(Database.BatchableContext BC, List<jstcl__TG_Timesheet__c> a){
for(jstcl__TG_Timesheet__c b : a) {
           b.Checkbox1__c = True;
        }
update a;

    }
global void finish(Database.BatchableContext BC){
    
    
}

}

Here is my test that gets 50% and an error on the method that states:
"System.QueryException: Use query() for non-count queries | Class.placementTimecardAuditFlagTest2.TimecardTestMethod: line 15, column 1" 
 
@istest 
class placementTimecardAuditFlagTest {
 
static testmethod void TimecardTestMethod(){
    jstcl__TG_Timesheet__c ts = new jstcl__TG_Timesheet__c();
    ts.Checkbox1__c = True;

Test.startTest();
	placementTimecardAuditFlag obj = new placementTimecardAuditFlag();
    DataBase.executeBatch(obj); 
           
Test.stopTest();
System.AssertEquals(database.countquery('SELECT TCEDaudit__c FROM ts2__Placement__c'),1);
    }
   
}


 
I'm currently trying to write a SOQL Query to pull all Accounts that have > 5 related Contact objects. How do I go about counting related objects? 
I'm receiving an error when attempting to run my test class. jstcl__Placement__c is a lookup who's parent is ts2__Placement__c which is why I construct it initially.

Error:
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ts2.Placement: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.ts2.Placement: line 14, column 1: []
 
@istest
public class placementTimecardAuditFlagTest{
    
     static testMethod void myTest() {
         
		Contact a= new Contact(Lastname = 'Test');
		insert a;
        
        ts2__Placement__c b= new ts2__Placement__c();
        insert b;
 
// Create common test timesheets
        List<jstcl__TG_Timesheet__c> testTimesheets = new List<jstcl__TG_Timesheet__c>();
        for(Integer i=0 ;i <200;i++) { 			
            testTimesheets.add(new jstcl__TG_Timesheet__c(jstcl__Week_Ending__c = Date.today()-15, jstcl__Consultant__c = a.Id,jstcl__Placement__c=b.Name));
        }
        insert testTimesheets;       

         
// Create common test placements
        List<ts2__Placement__c> testPlacements = new List<ts2__Placement__c>();
        for(Integer i=0 ;i <200;i++) {
            testPlacements.add(new ts2__Placement__c(ts2__Status__c = 'Active'));

        }
        insert testPlacements;        
//Testing
    Test.startTest();  
        
      placementTimecardAuditFlag obj = new placementTimecardAuditFlag();
        DataBase.executeBatch(obj); 
        
        Test.stopTest();
        System.AssertEquals(database.countquery('SELECT TCEDaudit__c FROM ts2__Placement__c'),1);
    }}




 
Can't seem to figure out how to get code coverage for the Apex Batch Class I have below. 
global class placementTimecardAuditFlag implements Database.Batchable<sObject>, Database.Stateful {

  List<jstcl__TG_Timesheet__c> query = [SELECT jstcl__Placement__r.Name FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c ='Active' AND jstcl__Placement__r.jstcl__Timesheet_Period__c != 'Weekly Split' AND jstcl__Week_Ending__c = LAST_N_DAYS:15 AND jstcl__Status__c = 'Pending'];
    Set<String> encounteredNames = new Set<String>();
    Set<String> duplicateNames = new Set<String>();

global Database.QueryLocator start(Database.BatchableContext bc) {
        for(jstcl__TG_Timesheet__c item : query){
    if(encounteredNames.contains(item.jstcl__Placement__r.Name)){
        duplicateNames.add(item.jstcl__Placement__r.Name);
    }
    else{encounteredNames.add(item.jstcl__Placement__r.Name);}
    }
      return Database.getQueryLocator('SELECT Id,Checkbox1__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.Name IN :duplicateNames');}
      

 global void execute(Database.BatchableContext BC, List<jstcl__TG_Timesheet__c> a){
    for(jstcl__TG_Timesheet__c b : a) {
        if(b.Checkbox1__c = True){
           b.Checkbox1__c = False;
        }
        else{b.Checkbox1__c = True;}}
update a;        
    }
global void finish(Database.BatchableContext BC){}
}
This is what I have so far for a test class. Basically what I need it to do is to check that when the test records are inserted that the TCEDAudit__c field on the ts2__Placement__c record is getting set to 1. 
 
@istest
public class placementTimecardAuditFlagTest{
    
    @testSetup static void setupTimesheet() {
// Create common test timesheets with a week ending date that exceeds the previous 15 days
        List<jstcl__TG_Timesheet__c> testTimesheets = new List<jstcl__TG_Timesheet__c>();
        for(Integer i=0 ;i <200;i++) {
            testTimesheets.add(new jstcl__TG_Timesheet__c(jstcl__Week_Ending__c = date.newInstance(2000, 12, 1)));
        }
        insert testTimesheets;       

// Create common test placements containing Active status
        List<ts2__Placement__c> testPlacements = new List<ts2__Placement__c>();
        for(Integer i=0 ;i <200;i++) {
            testPlacements.add(new ts2__Placement__c(ts2__Status__c = 'Active'));

        }
        insert testPlacements;        
//Begin testing
		Test.startTest();  
        
    	placementTimecardAuditFlag obj = new placementTimecardAuditFlag();
        DataBase.executeBatch(obj); 
        
        Test.stopTest();
        System.AssertEquals(testPlacements.TCEDaudit__c,1);
    }}

 
in a System.AssertEquals() is it possible to have some kind of logic in the expected outcome? For example, if I just need the expected outcome to be greater than 0.
 
System.AssertEquals(database.countquery('SELECT ts2__Placement__r.TCEDaudit__c FROM Placement'), > 1 );

 
I'm trying to write a test class for some Batch Apex that I've written and I'm not sure how to go about getting the needed coverage on Apex like this. Below I've included what I currently have for my Batch Class. Could someone point me in the right direction? Thank you! 
 
global class placementTimecardAuditFlag implements Database.Batchable<sObject>, Database.Stateful {

  List<jstcl__TG_Timesheet__c> query = [SELECT jstcl__Placement__r.Name FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c ='Active' AND jstcl__Placement__r.jstcl__Timesheet_Period__c != 'Weekly Split' AND jstcl__Week_Ending__c = LAST_N_DAYS:15 AND jstcl__Status__c = 'Pending'];
    Set<String> encounteredNames = new Set<String>();
    Set<String> duplicateNames = new Set<String>();

global Database.QueryLocator start(Database.BatchableContext bc) {
        for(jstcl__TG_Timesheet__c item : query){
    if(encounteredNames.contains(item.jstcl__Placement__r.Name)){
        duplicateNames.add(item.jstcl__Placement__r.Name);
    }
    else{encounteredNames.add(item.jstcl__Placement__r.Name);}
    }
      return Database.getQueryLocator('SELECT Id,Checkbox1__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.Name IN :duplicateNames');}
      

 global void execute(Database.BatchableContext BC, List<jstcl__TG_Timesheet__c> a){
    for(jstcl__TG_Timesheet__c b : a) {
        if(b.Checkbox1__c = True){
           b.Checkbox1__c = False;
        }
        else{b.Checkbox1__c = True;}}
update a;        
    }
global void finish(Database.BatchableContext BC){}
}





 
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. 
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 ++;
}
}
}}

 
I currently am working on creating a Scheduled Apex Batch Class that pulls all jstcl__Placement__r.Name that exist on Timesheet__C that currently exceed 14 days since they have had time entered AND jstcl__Placement__r.ts2__Status__c = 'Active'. These are related objects that have some field relationships that I'm using.
It then takes that list of Placement Names from the Timesheet and the execute portion of the batch class needs to determine if there are duplicates within that list and + 1 to the placement.TimecardEnddateAudit__c field (picklist) of any duplicate record returned. What I have adds +1 to ALL the returned placements which isn't quite there. (or maybe that's entirely wrong too) Here is what I have so far. Any help is much appreciated. Appologies if my explaination is rough. 
 
global class timecardEndDateAudit implements Database.Batchable<sObject>, Database.Stateful {

  global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT jstcl__Placement__r.Name, Primary_Recruiter__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c = \'Active\' AND jstcl__Week_Ending__c = LAST_N_DAYS:14 AND (jstcl__Status__c = \'Pending\')';
        return Database.getQueryLocator(query);
  }
  
  global void execute(Database.BatchableContext BC, List<sObject> placements){
        for (ts2__Placement__c placement : (List<ts2__Placement__c>) placements) {

            placement.TimecardEnddateAudit__c = placement.TimecardEnddateAudit__c + 1;
        }
       
        update placements;
  }
  global void finish(Database.BatchableContext BC){ }
}

 
When I attempt to save my Apex Class I receive the error "Error: Compile Error: Unexpected token 'class timecardEndDateAudit implements Database.Batchable'. at line 3 column 8"
I can't seem to figure out what I'm missing here. 

gobal class timecardEndDateAudit implements Database.Batchable<sObject>,Database.Stateful{

global Database.QueryLocator start(Database.BatchableContext bc){

String query = 'SELECT jstcl__Placement__r.Name , Account_Executive__c , jstcl__Placement__r.Timecard_End_Date_Audit__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Week_Ending__c >= LAST_N_DAYS:14'

return Database.getQueryLocator(query);
global void execute(Database.BatchableContext bc,List<Placement>scope){

for (Placement Placements :scope){
Placements.Timecard_End_Date_Audit__c ='1';
}
update scope;
}
global void finish(Database.BatchableContext bc){}
}
Has anyone built a feature to retrieve a user's username? There is a Forgot my Password but you have to provide your username and since you can't duplicate this between orgs I'd like to build this self service functionality. 

I was thinking of a lightning page where you enter your email, then the page checks for active users with that email and if none, shows an error. If found, it could trigger a templated email to their email with their username. Anyone done something similar? 
I'm trying to not allow the "," character to be used in a specific field. What I'm currently using below doesn't seem to be working and I'm stuck. 

NOT(REGEX(Address_Line_1__c , "[a-zA-Z0-9$%&]"))
I have a field that has a picklist that offers the options "Y" or "N". I have a separate field that needs to be empty if the answer is Y and required if the answer is N to that previous field. 

This is the validation I have to make it required if "N": 

AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c , "N") 
)



The field that it is applied to is called "Bank_Deposit_Deduction_Amount_1__c"
I just can't seem to figure out the "Must be blank" part for "Y". Appologies if I'm missing something obvious here. I have been going through the guide and can't seem to find it. 
I am pretty new at this and trying to create a lightning component so that community users that can't remember their username are able to enter an email address to retrieve their username. If the email they enter matches an existing user account's listed email address it will kick an email to that address with the username of the account. Anyone have anything or knowledge of an open source resource that might have something similar? Thank you!
I am currently trying to use the functionality of the "Contact Support & Ask Buttons" base Lightning Component but I really would like to alter some of it's functionality. Especially because it isn't available to be used for all page types. It looks like the base component code isn't available to be viewed and therefore altered. Is there anyway that I could obtain this code? 
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. 
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 ++;
}
}
}}

 
I currently am working on creating a Scheduled Apex Batch Class that pulls all jstcl__Placement__r.Name that exist on Timesheet__C that currently exceed 14 days since they have had time entered AND jstcl__Placement__r.ts2__Status__c = 'Active'. These are related objects that have some field relationships that I'm using.
It then takes that list of Placement Names from the Timesheet and the execute portion of the batch class needs to determine if there are duplicates within that list and + 1 to the placement.TimecardEnddateAudit__c field (picklist) of any duplicate record returned. What I have adds +1 to ALL the returned placements which isn't quite there. (or maybe that's entirely wrong too) Here is what I have so far. Any help is much appreciated. Appologies if my explaination is rough. 
 
global class timecardEndDateAudit implements Database.Batchable<sObject>, Database.Stateful {

  global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT jstcl__Placement__r.Name, Primary_Recruiter__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c = \'Active\' AND jstcl__Week_Ending__c = LAST_N_DAYS:14 AND (jstcl__Status__c = \'Pending\')';
        return Database.getQueryLocator(query);
  }
  
  global void execute(Database.BatchableContext BC, List<sObject> placements){
        for (ts2__Placement__c placement : (List<ts2__Placement__c>) placements) {

            placement.TimecardEnddateAudit__c = placement.TimecardEnddateAudit__c + 1;
        }
       
        update placements;
  }
  global void finish(Database.BatchableContext BC){ }
}

 
When I attempt to save my Apex Class I receive the error "Error: Compile Error: Unexpected token 'class timecardEndDateAudit implements Database.Batchable'. at line 3 column 8"
I can't seem to figure out what I'm missing here. 

gobal class timecardEndDateAudit implements Database.Batchable<sObject>,Database.Stateful{

global Database.QueryLocator start(Database.BatchableContext bc){

String query = 'SELECT jstcl__Placement__r.Name , Account_Executive__c , jstcl__Placement__r.Timecard_End_Date_Audit__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Week_Ending__c >= LAST_N_DAYS:14'

return Database.getQueryLocator(query);
global void execute(Database.BatchableContext bc,List<Placement>scope){

for (Placement Placements :scope){
Placements.Timecard_End_Date_Audit__c ='1';
}
update scope;
}
global void finish(Database.BatchableContext bc){}
}
I am pretty new at this and trying to create a lightning component so that community users that can't remember their username are able to enter an email address to retrieve their username. If the email they enter matches an existing user account's listed email address it will kick an email to that address with the username of the account. Anyone have anything or knowledge of an open source resource that might have something similar? Thank you!
I currently am only able to get 50% coverage on a test class that I am writing for some Batch Apex that I have written. The issue is that there are a number of lookups/relationships between objects when attempting to create the test records. Specifically  I am in a time crunch and the batch class does not edit anything particularly important or detrimental to the record. It only queries some relevant records/stipulations and changes a checkbox field on the jstcl__TG_Timesheet__c object that is there purely for tracking. How would I go about getting full coverage? Whether that's a mock or not I don't mind, I just have to get this pushed to production quickly. Thank you so much in advance. Here is my Batch Apex:
 
global class placementTimecardAuditFlag implements Database.Batchable<sObject>, Database.Stateful {

  List<jstcl__TG_Timesheet__c> query = [SELECT jstcl__Placement__r.Name FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c ='Active' AND jstcl__Placement__r.jstcl__Timesheet_Period__c != 'Weekly Split' AND jstcl__Week_Ending__c = LAST_N_DAYS:15 AND jstcl__Status__c = 'Pending'];
    Set<String> encounteredNames = new Set<String>();
    Set<String> duplicateNames = new Set<String>();

global Database.QueryLocator start(Database.BatchableContext bc) {
        for(jstcl__TG_Timesheet__c item : query){
    if(encounteredNames.contains(item.jstcl__Placement__r.Name)){
        duplicateNames.add(item.jstcl__Placement__r.Name);
    }
    else{encounteredNames.add(item.jstcl__Placement__r.Name);}
    }
      return Database.getQueryLocator('SELECT Id,Checkbox1__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.Name IN :duplicateNames');}
      

 global void execute(Database.BatchableContext BC, List<jstcl__TG_Timesheet__c> a){
for(jstcl__TG_Timesheet__c b : a) {
           b.Checkbox1__c = True;
        }
update a;

    }
global void finish(Database.BatchableContext BC){
    
    
}

}

Here is my test that gets 50% and an error on the method that states:
"System.QueryException: Use query() for non-count queries | Class.placementTimecardAuditFlagTest2.TimecardTestMethod: line 15, column 1" 
 
@istest 
class placementTimecardAuditFlagTest {
 
static testmethod void TimecardTestMethod(){
    jstcl__TG_Timesheet__c ts = new jstcl__TG_Timesheet__c();
    ts.Checkbox1__c = True;

Test.startTest();
	placementTimecardAuditFlag obj = new placementTimecardAuditFlag();
    DataBase.executeBatch(obj); 
           
Test.stopTest();
System.AssertEquals(database.countquery('SELECT TCEDaudit__c FROM ts2__Placement__c'),1);
    }
   
}


 
I'm currently trying to write a SOQL Query to pull all Accounts that have > 5 related Contact objects. How do I go about counting related objects? 
I'm receiving an error when attempting to run my test class. jstcl__Placement__c is a lookup who's parent is ts2__Placement__c which is why I construct it initially.

Error:
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ts2.Placement: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.ts2.Placement: line 14, column 1: []
 
@istest
public class placementTimecardAuditFlagTest{
    
     static testMethod void myTest() {
         
		Contact a= new Contact(Lastname = 'Test');
		insert a;
        
        ts2__Placement__c b= new ts2__Placement__c();
        insert b;
 
// Create common test timesheets
        List<jstcl__TG_Timesheet__c> testTimesheets = new List<jstcl__TG_Timesheet__c>();
        for(Integer i=0 ;i <200;i++) { 			
            testTimesheets.add(new jstcl__TG_Timesheet__c(jstcl__Week_Ending__c = Date.today()-15, jstcl__Consultant__c = a.Id,jstcl__Placement__c=b.Name));
        }
        insert testTimesheets;       

         
// Create common test placements
        List<ts2__Placement__c> testPlacements = new List<ts2__Placement__c>();
        for(Integer i=0 ;i <200;i++) {
            testPlacements.add(new ts2__Placement__c(ts2__Status__c = 'Active'));

        }
        insert testPlacements;        
//Testing
    Test.startTest();  
        
      placementTimecardAuditFlag obj = new placementTimecardAuditFlag();
        DataBase.executeBatch(obj); 
        
        Test.stopTest();
        System.AssertEquals(database.countquery('SELECT TCEDaudit__c FROM ts2__Placement__c'),1);
    }}




 
I currently am working on creating a Scheduled Apex Batch Class that pulls all jstcl__Placement__r.Name that exist on Timesheet__C that currently exceed 14 days since they have had time entered AND jstcl__Placement__r.ts2__Status__c = 'Active'. These are related objects that have some field relationships that I'm using.
It then takes that list of Placement Names from the Timesheet and the execute portion of the batch class needs to determine if there are duplicates within that list and + 1 to the placement.TimecardEnddateAudit__c field (picklist) of any duplicate record returned. What I have adds +1 to ALL the returned placements which isn't quite there. (or maybe that's entirely wrong too) Here is what I have so far. Any help is much appreciated. Appologies if my explaination is rough. 
 
global class timecardEndDateAudit implements Database.Batchable<sObject>, Database.Stateful {

  global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT jstcl__Placement__r.Name, Primary_Recruiter__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Placement__r.ts2__Status__c = \'Active\' AND jstcl__Week_Ending__c = LAST_N_DAYS:14 AND (jstcl__Status__c = \'Pending\')';
        return Database.getQueryLocator(query);
  }
  
  global void execute(Database.BatchableContext BC, List<sObject> placements){
        for (ts2__Placement__c placement : (List<ts2__Placement__c>) placements) {

            placement.TimecardEnddateAudit__c = placement.TimecardEnddateAudit__c + 1;
        }
       
        update placements;
  }
  global void finish(Database.BatchableContext BC){ }
}

 
When I attempt to save my Apex Class I receive the error "Error: Compile Error: Unexpected token 'class timecardEndDateAudit implements Database.Batchable'. at line 3 column 8"
I can't seem to figure out what I'm missing here. 

gobal class timecardEndDateAudit implements Database.Batchable<sObject>,Database.Stateful{

global Database.QueryLocator start(Database.BatchableContext bc){

String query = 'SELECT jstcl__Placement__r.Name , Account_Executive__c , jstcl__Placement__r.Timecard_End_Date_Audit__c FROM jstcl__TG_Timesheet__c WHERE jstcl__Week_Ending__c >= LAST_N_DAYS:14'

return Database.getQueryLocator(query);
global void execute(Database.BatchableContext bc,List<Placement>scope){

for (Placement Placements :scope){
Placements.Timecard_End_Date_Audit__c ='1';
}
update scope;
}
global void finish(Database.BatchableContext bc){}
}
I have a field that has a picklist that offers the options "Y" or "N". I have a separate field that needs to be empty if the answer is Y and required if the answer is N to that previous field. 

This is the validation I have to make it required if "N": 

AND( 
ISPICKVAL(Bank_Full_Deposit_Flag_1__c , "N") 
)



The field that it is applied to is called "Bank_Deposit_Deduction_Amount_1__c"
I just can't seem to figure out the "Must be blank" part for "Y". Appologies if I'm missing something obvious here. I have been going through the guide and can't seem to find it.