You need to sign in to do that
Don't have an account?

how to move opportunity under comapaign?
i need to find all the opportunity whose status is "closed lost" and create a camapigjn for them...i did like this but its not working.Please rectify the error:-
public class moveopportunity
{
List<Opportunity> selectopp;
public string campaignid1;
public string conactid;
public moveopportunity()
{
selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];
}
public void move()
{
if(selectopp!=null)
{
for(Opportunity O:selectopp)
{
O.CampaignId = '70190000000MjHs';
update O;
}
}
}
}