Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

When i manually delete the opp line item schedules from the layout the quantity field of opp line item doesn't get affected(it doesn't become zero).

Where as thru my apex code it deletes the schedules and setsthe line item quantity to '0'.

What is the reason and How to resolve it?

Thanks in Advance.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

From the OpportunityLineItemSchedule documentation under the Effects on Opportunities and Opportunity Line Items heading.

Deleting an OpportunityLineItemSchedule decrements the OpportunityLineItem TotalPrice by the deleted OpportunityLineItemSchedule Quantity or Revenue amount.

The Opportunity Amount is also decremented by the OpportunityLineItemSchedule Quantity or Revenue amount, and the Opportunity ExpectedRevenue is reduced by OpportunityLineItemSchedule Quantity or Revenue amount multiplied by the Opportunity Probability.

Also under Deleting an Opportunity Line Item Schedule:

Deleting the last remaining schedule will set the corresponding HasQuantitySchedule or HasRevenueSchedule flags (or both) to false on the parent line item.

So the behaviour you are seeing when deleting the the OpportunityLineItemSchedule records from Apex sounds correct. The OpportunityLineItem Quantity will decrease.

You would need to increment the OpportunityLineItem Quantity again in apex code after deleting the OpportunityLineItemSchedules.

share|improve this answer
    
If i delete all the schedules from UI its not setting updating the lineitem quantuty. Whats the reason ? –  NeverGiveUp Dec 19 '12 at 9:27
    
@VipulReddy From your description, it would appear that the UI will automatically reallocate the Quantity to the OpportunityLineItem. I'd suggest capturing the debug logs for both as they will show you exactly what is happening. –  Daniel Ballinger Dec 19 '12 at 19:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.