You need to sign in to do that
Don't have an account?
Nitish 73
Comparison arguments must be compatible types
Hi All,
I am trying to conditionally run a trigger with an IF condition.
But this is the error I get
"Comparison arguments must be compatible types"
Here is my code. My requirement is that, this trigger has to run when the Status is not 'Approved' or 'Issued'
Any help is appreciated.
Thanks
Nitish
I am trying to conditionally run a trigger with an IF condition.
But this is the error I get
"Comparison arguments must be compatible types"
Here is my code. My requirement is that, this trigger has to run when the Status is not 'Approved' or 'Issued'
trigger Insert_Junction on Authorizations__c (After update) { if(Authorizations__c.Status__c<>'Approved' || Authorizations__c.Status__c<>'Issued'){ CreateJunction createjunction = new CreateJunction(); createjunction .createJunctionRecord(trigger.new); } }
Any help is appreciated.
Thanks
Nitish
Note that this will fire on all because != || != will always be true.
All Answers
Note that this will fire on all because != || != will always be true.
That should read:
"You are using the object name and not the reference to the object from the trigger class."
You have to pull the object out of the Trigger class and operate on that if you want to compare what it's value is. And you want to do this for more than just Trigger.new.get(0) because you want to make sure your trigger works on bulk data.
Also, thanks for the headsup about the != || != , i replaced it with the other options on which this should fire. Made the condition a little longer, but it works.
Thanks a lot.
Nitish