You need to sign in to do that
Don't have an account?
Ashu sharma 38
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
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
Trigger concept
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
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
Please find sample code below :
I have not tested the above code may you will get some syntactical errors.
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Project Support and training: varaprasad4sfdc@gmail.com
Please try the below code and mark as Best Answer.
trigger AppBlack on Application__c(before insert){
list<Decimal> panNnos = new list<Decimal>();
for(Application__c ap : trigger.new){
if(ap.Pancard__c != null){
panNnos.add(ap.Pancard__c );
}
}
if(panNnos != null){
list<BlackList__c> ban = [select id,name,Phone__c,Pancard__c from BlackList__c where Pancard__c in : panNnos ];
if(ban.size() > 0){
for(BlackList__c b : ban){
for(Application__c ap : trigger.new){
if(b.Pancard__c == ap.Pancard__c){
ap.addError('Pancard already exists with following phone number'+b.Phone__c);
}
}
}
}
}
}
Regards,
Asad Shaikh