You need to sign in to do that
Don't have an account?

Trigger change
Hi,
I wrote trigger as following:
trigger UpdateSADeclined on Task (before insert,before update) {
for(Task x: Trigger.new)
{
If (x.Declined_by__c==null|| x.Date_Time_Declined__c==null|| x.Declined_Reason__c==null)
{
x.SA_Declined__c=true;
}
else
{ x.SA_Declined__c=false;
}
}
}
By this trigger checkbox field SADeclined is checked whenever any of date field value ( declined by, date time declined and declined reason) is null, otherwise it’s unchecked ( means whenever all three fields are populated).
Now, My requirement is whenever there is value in date field SADeclined should be unchecked, i.e. when all three date fields are null the SADeclined will be checked.
Kindly help me to change the trigger.
I wrote trigger as following:
trigger UpdateSADeclined on Task (before insert,before update) {
for(Task x: Trigger.new)
{
If (x.Declined_by__c==null|| x.Date_Time_Declined__c==null|| x.Declined_Reason__c==null)
{
x.SA_Declined__c=true;
}
else
{ x.SA_Declined__c=false;
}
}
}
By this trigger checkbox field SADeclined is checked whenever any of date field value ( declined by, date time declined and declined reason) is null, otherwise it’s unchecked ( means whenever all three fields are populated).
Now, My requirement is whenever there is value in date field SADeclined should be unchecked, i.e. when all three date fields are null the SADeclined will be checked.
Kindly help me to change the trigger.
I did it with ! operator. Thank you for reply.