You need to sign in to do that
Don't have an account?
Tanya Shah
trigger to update dates
I want to write a trigger to Update product dates when opp close date changes .
There are number of products added to particular opportunity and each one has different ServiceDate .Following is what i tried ,
http://thysmichels.com/2012/04/10/salesforce-update-product-schedule-from-opportunity-product-using-apex-trigger/
Thank you !
There are number of products added to particular opportunity and each one has different ServiceDate .Following is what i tried ,
trigger productUpdate on Opportunity (after update) { OpportunityLineItem[] olis = [SELECT OpportunityId, ServiceDate, Opportunity.CloseDate FROM OpportunityLineItem WHERE OpportunityId IN :Trigger.New]; for(OpportunityLineItem oli :olis) { oli.ServiceDate = Trigger.newMap.get(oli.OpportunityId).CloseDate.addDays(oli.ServiceDate.daysBetween(oli.Opportunity.CloseDate)); } update olis; }This is working but not giving me improper dates . Something random . I want to refer to below link to get it to similar way
http://thysmichels.com/2012/04/10/salesforce-update-product-schedule-from-opportunity-product-using-apex-trigger/
Thank you !
Shashikant Sharma
Could you share some input and there expected and actual output.
Tanya Shah
Want to explain a scenario . For eg,When we go to showroom, they say BMW(Prod 1) will get in next 100 days , then Audi(Prod 2) in 50 days , Activa(Prod 3) in 20 days etc . This all will be while updating Opportunity close date . It should be different dates for diff products likewise .Thank you !