You need to sign in to do that
Don't have an account?
Mishal Jose
How to compare field of existing record and new record
Need to solve a problem, I need to throw a error if the record with different value of country is inserted in object. Example: I need to check the value of existing country field and if the new record is inserted with different country value, I need to throw an error. Is there a way to achieve this.?
Are you okay to use Trigger on that object is this scenerio?
Thanks,
you can perform logic as
first make a set<country datatype>() or map <id,string> and populate that with one record
thn you have to itearate record with collection thn
check if(set.contains(record re.country){
than save that record
else {
record.adderror('your error messsage');
Thanks for confirmation . Do you meant that If i am creating a record with country as India and if no records are present with Country as India then it should throw an error?
Thanks,