Skip to Content
0
Former Member
Jul 09, 2015 at 10:27 PM

How to add a line item in an Opportunity

22 Views

Hello gurus,

I need to add a line item automatically when an opportunity is created.

For this, I have all the required fields. But I get a dump when i do the following way:

this is in beforesave of opportunity

var revlineitem : elementsof this.Item;

var firstitem;

revlineitem.ExpectedNetAmount.content = this.Revenue.content;

revlineitem.ExpectedNetAmount.currencyCode = this.Revenue.currencyCode;

revlineitem.ExpectedRevenueDatePeriod=this.SalesForecast.ExpectedRevenueDatePeriod;

this.Item.Create(revlineitem);

if(this.Item.Count()>0){

firstitem = this.Item.GetFirst();

//set values

}

I also tried to add prod category but the same issue.

Looks like they are not open for write access. Is there any other way.

Any help is appreciated.

thanks

Mahesh