|
Hi All, I have been developing a tool that will allow the import of opportunities on mass. I have successfully performed all tasks including user lookup, stage and process lookup, all data assignment etc. I am struggling, however, to populate and assign an OpportunityProduct object to the newly created Opportunity Object. I assume the code to do this will follow the following structure: //create the Opportunity object Opportunity newOpp = framework.Opportunities.CreateOpportunity(); //assign all the fields etc to the opportunity newOpp.Fields[fieldName, true] = value; I can create a product using Product newProd = framework.Products.CreateProduct(name, item, price, cost);
I also know you update the associated OpportunityProducts of an Opportunity using the following newOpp.UpdateProducts(new OpportunityProduct[] {productToAdd},new OpportunityProduct[] {}); I know there is an Product Manager and OpportunityProductManager framework.Products framework.Products.OpportunityProductManager and an OpportunityProduct Constructor although I have no idea how to use the associated state parameter!! public OpportunityProduct( CustomSubEntity.CustomSubEntityInitializationState state I would appreciate any help in constructing a newOpportunityProduct and attaching it to an Oportunity. Many Thanks, Rob.
|