function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
suneilchetlursuneilchetlur 

Deleting line item schedules deletes makes the quantity field on line item as zero

HI there,

 

I have a trigger on opportunity(after update) which in my scenario fires when the 'contract duration' field is changed on opp  page.What the trigger does is that it deletes all the opp lineitem schedules and creates new ones based on the contract duration(the value indicates the number of schedules) for each opp line item.

All of this function is working fine but there is just one thing that has put me in a fix here.THe new schedules that are created has quantity as zero.What i noticed with debug logs is that when you delete opp schedules of a particular opp line item the opp line item quantity becomes zero.However,I want to use the same quantity while creating the new opp line item schedules.I tried a few things but nothing seems to work fine and I am still getting the quantity as zero.The schedules are however getting created(the right number,the right schedule dates but quantity zero).

 

There's one thing i noticed when i manually delete the opp line item schedules from the layout the quantity field of opp line item doesn't get affected(it doesnt become zero).

 

Any suggestoins on how to capture the quantity of the line item so that even when schedules are deleted the quantity value remains intact on the line item(so that it can be used while inserting new line item schedules).

 

Note:I am referring to quantity schedules here.

 

Thanks in  advance,

 

Suneil

Cool_DevloperCool_Devloper

Mr Suniel,

Maybe you can save the value temporarily and write this logic in an BeforeDelete Trigger!

Cool_D