+ Start a Discussion
Gangadhar LGangadhar L 

Create objs Application(Name,Panno,Phone)&BlackList(Name,Panno ,Phone) a. Whenever we r inserting new Appl it has to check panno no of the new appl rcrd is in Blist r not. b.If its there, then update bList phone with new application phone&throw eror

Q)Create a new Custom objects Application and BlackList
Object Name                           Field Names
Application                               Name,Pancard ,Phone
BlacKList                                 Name,Pancard,phone
a). When ever we are inserting new Application it has to check pancard no of the new application record is 
in the Blakc list or not .
b).If the pancard of the Appliction is in the blacklist object then update the blackList phone with new application phone no  and throw error
v varaprasadv varaprasad
Hi Gangadhar,

Please check once sample code below : 
Trigger checkPanNo on Application__C(Before insert){

set<string> panNos = new set<string>();

for(Application__C app : trigger.new){
    if(app.PanNo__C != null){

List<BlacKList__c> blcklist = [select id,name,BlaPano__c,Phone__c from BlacKList__c where BlaPano__c in : panNos];
   for(BlacKList__c blk : blcklist){  
       for(Application__C apps : trigger.new){
	       blk.Phone__c = apps.PanNo__C;
	       apps.PanNo__C.adderror('PanNo already exists')

Update blcklist;

Hope it helps you.
Please let me know in case of any other help.