//When the lead is converted to account and contact then the cases under that lead carried to account and contact created from lead conversion
trigger leadtrig on Lead (after update) {
list<Id> leadids = new list<Id>();
for(Lead objLead:trigger.new){
if(objLead.IsConverted)
leadids.add(objLead.id);
}
list<case> lstcase=[Select id from case where Lead__c in:leadids];
List<Case> lstcasetoupdate = new List<case>();
if(lstcase != null){
for(Lead obj: trigger.new){
if(obj.IsConverted){
for(case c: lstcase){
c.accountid = obj.convertedAccountid;
c.contactid = obj.convertedContactid;
c.Lead__c = null;
lstcasetoUpdate.add(c);
}
}
}
if(lstcasetoUpdate.size()>0){
update lstcasetoUpdate;
}
}
}
================================Test class on Trigger involves lead conversion as above=================
@isTest
private class Testonleadtrig {
private static Id leadId;
static {
Lead testLead = new Lead();
testLead.FirstName = 'Test First';
testLead.LastName = 'Test Last';
testLead.Company = 'Test Co';
testLead.npe01__Preferred_Phone__c='Home';
testLead.Status='Untouched';
testLead.Company='Appshark';
insert testLead;
leadId = testLead.Id;
}
static testMethod void Test_LeadConvert(){
Test.startTest();
Case csobj=new Case();
csobj.Subject='Email';
csobj.Status='New';
csobj.Origin='Email';
csobj.Lead__c=LeadId;
insert csobj;
Database.LeadConvert lc = new database.LeadConvert();
lc.setLeadId(LeadId);
LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus where IsConverted=true limit 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
Test.stopTest();
}
}
Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me
ReplyDeleteClick here:
angularjs training in tambaram
Click here:
angularjs6 Training in Chennai
Excellant post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ReplyDeleteClick here:
Microsoft azure training in tambaram
Click here:
Microsoft azure training in chennai
That was a great message in my carrier, and It's wonderful commands like mind relaxes with understand words of knowledge by information's.
ReplyDeleteBlueprism training in Chennai
Blueprism training in Bangalore
Blueprism training in Pune
Blueprism online training
Blueprism training in tambaram
I love the blog. Great post. It is very true, people must learn how to learn before they can learn. lol i know it sounds funny but its very true. . .
ReplyDeletejava training in tambaram | java training in velachery
java training in omr | oracle training in chennai
This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here
ReplyDeleteData Science course in Chennai | Data science course in bangalore
Data science course in pune | Data science online course
Data Science Interview questions and answers | Python course in Kalyan nagar
Well done! Pleasant post! This truly helps me to discover the solutions for my inquiry. Trusting, that you will keep posting articles having heaps of valuable data. You're the best!
ReplyDeleteangularjs Training in marathahalli
angularjs interview questions and answers
angularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in chennai
It’s a shame you don’t have a donate button! I’d certainly donate to this brilliant blog! I suppose for now I’ll settle for book-marking and adding your RSS feed to my Google account.
ReplyDeleteindustrial safetyu courses in chennai
It’s great to come across a blog every once in a while, that isn’t the same out of date rehashed material. Fantastic read.
ReplyDeleteCloud Training
Software Testing Training
Oracle DBA Training
Angular Training in Chennai
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteDotnet Training in Chennai |Best Dotnet Training course in Chennai
Android Training in Chennai |Best Android Training course in Chennai
CCNA Training in Chennai | Best CCNA Training course in Chennai
MCSE Training in Chennai |Best MCSE Training course in Chennai
Embedded Systems Training in Chennai |Best Embedded Systems Training course in Chennai
Matlab Training in Chennai | Best Matlab Training course in Chennai
Unix Training in Chennai | Best Unix Training in Chennai
Sql Training in Chennai | Best Sql Training in Chennai
Oracle Training in Chennai | Best Oracle Training in Chennai
Digital Marketing Training in Chennai | Best Digital Marketing Training in Chennai
Nice and good post. This is a wonderful article, Given so much info in it, keep sharing.
ReplyDeleteData Science Bangalore
Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written.
ReplyDeletedate analytics certification training courses
data science courses training
data analytics certification courses in Bangalore
ExcelR Data science courses in Bangalore
Just pure brilliance from you here. I have never expected something less than this from you and you have not disappointed me at all. I suppose you will keep the quality work going on.
ReplyDeleteData Science Course in Pune
It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
ReplyDeleteData science Course Training in Chennai |Best Data Science Training Institute in Chennai
RPA Course Training in Chennai |Best RPA Training Institute in Chennai
AWS Course Training in Chennai |Best AWS Training Institute in Chennai
Devops Course Training in Chennai |Best Devops Training Institute in Chennai
Selenium Course Training in Chennai |Best Selenium Training Institute in Chennai
Java Course Training in Chennai | Best Java Training Institute in Chennai
I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
ReplyDeletedata science course
Assume paid for with the help of center, have discovered modern society; believed that protect on your playlists, you could potentially know most of the hassle; assumed ones step quit, much more is unable to drive; Imagine I would like adore, merely the caress. asbestos inspection
ReplyDeleteGood post
ReplyDeletefreeinplanttrainingcourseforECEstudents
internship-in-chennai-for-bsc
inplant-training-for-automobile-engineering-students
freeinplanttrainingfor-ECEstudents-in-chennai
internship-for-cse-students-in-bsnl
application-for-industrial-training
Nice..
ReplyDeleteinterview-questions/aptitude/permutation-and-combination/how-many-groups-of-6-persons-can-be-formed
tutorials/oracle/oracle-delete
technology/chrome-flags-complete-guide-enhance-browsing-experience/
interview-questions/aptitude/time-and-work/a-alone-can-do-1-4-of-the-work-in-2-days
interview-questions/programming/recursion-and-iteration/integer-a-40-b-35-c-20-d-10-comment-about-the-output-of-the-following-two-statements
i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. hazard perception test sa
ReplyDelete-->create a trigger on Lead.
ReplyDelete--> When you convert leads to contacts or accounts, the process sometimes creates duplicate records.
-->Use Contact field to query the related Lead and then merge them with the Contact.
very useful post..
ReplyDeleteAustralia hosting
Bermuda web hosting
Botswana hosting
mexico web hosting
moldova web hosting
albania web hosting
andorra hosting
armenia web hosting
australia web hosting
good...
ReplyDeletedenmark web hosting
inplant training in chennai
Excellent and very cool idea and the subject at the top of magnificence and I am happy to comment on this topic through which we address the idea of positive re like this.
ReplyDeleteCRM Software in Denmark
This is very significant, and yet necessary towards just click this unique backlink: Viking, Sub-Zero, GE REFRIGERATOR REPAIR IN HIGHLAND
ReplyDeletesalesforce is one of the top crm using by companies..
ReplyDeleteonline data science training in bangalore
online data science with python training in bangalore
online data science course in bangalore
online react native training in bangalore
online react native course in bangalore
Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.thanks a lot guys.
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
ReplyDelete360DigiTMG, Indore is a leading solutions provider of Training and Consulting to assist students, professionals by delivering top-notch, world-class classroom and online training. It offers courses in ai training in indore.
Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.
ReplyDeleteSimple Linear Regression
Correlation vs Covariance
Nice blog. I finally found great post here Very interesting to read this article and very pleased to find this site. Great work!This looks absolutely perfect. All these tiny details are made with lot of background knowledge. I like it a lot. Data Science Training In Chennai | Certification | Data Science Courses in Chennai | Data Science Training In Bangalore | Certification | Data Science Courses in Bangalore | Data Science Training In Hyderabad | Certification | Data Science Courses in hyderabad | Data Science Training In Coimbatore | Certification | Data Science Courses in Coimbatore | Data Science Training | Certification | Data Science Online Training Course
ReplyDeleteAmazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteCorrelation vs Covariance
Simple Linear Regression
data science interview questions
KNN Algorithm
I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
ReplyDeleteSimple Linear Regression
Correlation vs Covariance
I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
ReplyDeletedata science interview questions