You need to sign in to do that
Don't have an account?
Mitesh Sura
Create OpportunityLineItemSchedule records automatically
I am building custom VF page for "Add Products". For most part it works fine, but it does create "OpportunityLineItemSchedule" records like standard "Add Products" screen.
What am I missing? Is there a way to set certain parameters to parent OpportunityLineItem object to achieve this? I found few examples on creating "OpportunityLineItemSchedule" records manually, but I would like to avoid that if Salesforce can do that automatically for me.
Thank you for your time.
regards
Mitesh
What am I missing? Is there a way to set certain parameters to parent OpportunityLineItem object to achieve this? I found few examples on creating "OpportunityLineItemSchedule" records manually, but I would like to avoid that if Salesforce can do that automatically for me.
Thank you for your time.
regards
Mitesh
This means no need of custom logic to create Schdule Line Items, it will happen automatically when creating line items.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitylineitemschedule.htm
All Answers
This is the recursive trigger issue when inserting OpportunityLineItemSchedule records from an after insert trigger on OpportunityLineItem.
By first checking if a static boolean that gets set at the end of the first trigger invocation is true the recursion could be avoided.
There is an example here: Controlling Recursive Triggers
http://developer.force.com/cookbook/recipe/controlling-recursive-triggers
https://developer.salesforce.com/forums/ForumsMain?id=906F000000090HrIAI
Regards,
Ashish
My question is, do we actually have to create those manually? Why would standard "Add Products" button work, but not custom VF page. Isn't there anyway we can automate the default scheduling?
regards
Mitesh
What Controller are you using, loosk like the Add Products Action Binding is not supported with the Standard Controller.
You can try instantiating Standard Controller.
See the related thread,
http://salesforce.stackexchange.com/questions/16843/visualforce-adding-new-products-to-a-table-on-same-page
Regards,
Ashish
here is the link of custom VF page for adding Products. https://na14.visual.force.com/apex/Products_Add?id=006d000000DAv0K.
If you look at the id in the URL. Obviously, I get this error "Id value 006d000000DAv0K is not valid for the OpportunityLineItem standard controller"
I liked the idea of invoking Opportunity Product standard controller on save, not sure how to achieve it though. ANy thoguts?
Not exactly sure. but see if the below links help,
You should look at the Snazzy Product Entry Screen from Michael Farrington. We use this internally and since it's an unmanaged package, you can customize it to your needs. I would think your "quantity" requirement would be easy to add to this.
This essentially replaces the add product page and the multiline edit page. It sounds like it might be exactly what you are looking for.
http://salesforce.stackexchange.com/questions/5581/has-anyone-tried-to-create-custom-add-product-page-and-multilineitem-page-from-o
http://www.michaelforce.org/recipeView?id=a0G30000006eVxVEAU
Regards,
Ashish
I am NOT looking for help on how to build custom VF page to add products. I GOT that. The links that you posted will not support SChduling too and THAT is what I need help with.
I actually have figured how it works, and build custom trigger to create scheduling records. I am still struglling on how does SF calcualate Quantity and Revenue if BOTH the default scheduling is turned on for a product.
Any help on that?
regards
Mitesh
See the blog below,
There is code for scheduleBuilder Controller and the method to call,
http://kermoony.wordpress.com/2012/04/09/opportunitylineitems-updates-via-visualforce-vf-in-salesforce-com/
Regards,
Ashish
I will give it a try anyways.
regards
Mitesh
Were you able to solve this problem? And more importantly, write test code? I'm having issues getting test code written for a trigger that updates the OpportunityLineItemSchedule when the OPportunity Close Date updates. I can't get the product schedules inserted so I can test to make sure they are updating properly.
Thanks for any feedback!
JoAnn
Looks like This issue has been addressed in the below post,
https://developer.salesforce.com/forums/ForumsMain?id=906F00000009cAaIAI
Regards,
Ashish
@Ashish: that link explans revenue schedule, which I have figured it out. Please see this community link which has more info: https://success.salesforce.com/answers?id=90630000000heJcAAI
regards
Mitesh
This means no need of custom logic to create Schdule Line Items, it will happen automatically when creating line items.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitylineitemschedule.htm