05-13-2009 07:48 AM - edited 05-13-2009 07:48 AM
I need to locate an opportunity and update various information regarding the status, stage etc.
I also need to update the data that is held within the associated Opportunity Product.
I am able to update the fields within the Opportunity itself but unfortunately I am struggling to update/overwrite any fields within the associated Product.
I was hoping to do something along the lines of:
opp.Products.Name = "New Name";
opp.Products.ItemNumber = "SKU";
However many of the fields are protected and cannot be altered using normal get/set commands.
I have also looked into the Opportunity.RemoveProducts() and Opportnity.AddProduc(methods but keep receiving the error message:
"Operation is not valid due to the current state of the object."
The only solution I can see at the moment is to delete the original opportunity and re-create a duplicate (with updated values) to replace it. But this surely cannot be right!
Thanks in advance.
05-14-2009 07:03 PM
When you received the message 'Operation is not valid due to the current state of the object.' was the opportunity Open? Because when it's closed, act also disables the products in the UI. I wonder if that's the issue.