You need to sign in to do that
Don't have an account?
sp13
trigger code conflict with lookup filter criteria
this is the trigger code:
it works perfectly when the lookup field Seat__c has no filter.
but i need to have filter criterias for this lookup field.
these are the filter criterias:
anyone knows what is the problem here?
trigger updateSeatTaken on Reservation__c (before insert, before update, after insert, after update) {
List<Id> seatIdsForUpdate = new List<Id>();
for (Reservation__c r : trigger.new) {
seatIdsForUpdate.add(r.Seat__c);
}
List<Seat__c> seatsForUpdate = [SELECT taken__c FROM Seat__c WHERE Id IN: seatIdsForUpdate];
for (Seat__c seat: seatsForUpdate) {
seat.Taken__c = true;
}
update seatsForUpdate;
}
List<Id> seatIdsForUpdate = new List<Id>();
for (Reservation__c r : trigger.new) {
seatIdsForUpdate.add(r.Seat__c);
}
List<Seat__c> seatsForUpdate = [SELECT taken__c FROM Seat__c WHERE Id IN: seatIdsForUpdate];
for (Seat__c seat: seatsForUpdate) {
seat.Taken__c = true;
}
update seatsForUpdate;
}
it works perfectly when the lookup field Seat__c has no filter.
but i need to have filter criterias for this lookup field.
these are the filter criterias:
Seat:Schedule__c equals Field Reservation:Schedule__c AND
Taken__c equals Value False
Taken__c equals Value False
anyone knows what is the problem here?
-Glyn
All Answers
If u keep some conditions before assigning values then values are not populating right!!!
U just keep some debug logs so that u caan see where the exact problem is.
Regards,
Rajesh.
-Glyn