You need to sign in to do that
Don't have an account?
Rajar Kumar
update records in the list with other list values
Hi Guys,
I have two list opps(opprtunity list) and ocList(OpportunityContactRole ) . I want to update one string field on opportunity(records in opps) with the value of contact name of contact role(records in.ocList) for example opps[0].test__c = ocList [0].Contact.Name
How can I achieve for all the records?
Please help
Thanks
I have two list opps(opprtunity list) and ocList(OpportunityContactRole ) . I want to update one string field on opportunity(records in opps) with the value of contact name of contact role(records in.ocList) for example opps[0].test__c = ocList [0].Contact.Name
How can I achieve for all the records?
Please help
Thanks
List<Opportunity> opps = new List<Opportunity>(); for (integer i=0; i<50; i++) { Opportunity opp = new Opportunity(); opp.AccountId=acc.Id; opp.Name='My Opportunity'+i; opp.StageName='Prospecting'; opp.CloseDate=date.today().adddays(i); opp.Open_Tasks__c = 0; //opp.LastActivityDate = System.today()+15; opps.add(opp); } insert opps List<OpportunityContactRole> ocList = new List<OpportunityContactRole>(); for(integer i=0; i<opps.size(); i++){ OpportunityContactRole ocr = new OpportunityContactRole(); ocr.ContactId = con.Id; ocr.OpportunityId = oppList[i].Id; ocr.IsPrimary = TRUE; ocr.Role = 'Decision Maker'; ocList.add(ocr); } insert ocList;
Raj Vakati
Try like this .. Remove hardcoded ID from this example