+ Start a Discussion
NNRNNR 

Bussiness logic in BatchAPex or Reports

HI All:  i have one scenario
Oppoerunity is closed/won then we need to create one child Record for Opportunity.we are captruring Closed/won date.
when closed/won date (28/8/2015) then user within 10days(8/9/2015) user unable to create child record send email to salesmanagaer.
In mail we need send minimum oppoerutnity details to salesmanager
How can i do it ?help me out
atla satheeshkumaratla satheeshkumar
Hi NNR,

Can you cinfirm one thing.
1) first you have to create one child Record whenever the Opportunity stage as Closed won Automatically.This is the first scenarion am i correct?
2)Then user try to create the next child record within 10 days salemanger will get mail with the Opportunity deatils am i correct?



 
atla satheeshkumaratla satheeshkumar
Hi NNR,

I am giving the solution for above mentioned criteria.

1)Create after insert Trigger on Opportunity to create a child Record.
2)Now create a Roll up summry field on Oppty to count childs.
3)Now write a Before Insert  trigger on Opptyproduct to stop the Child creation

give a condition if(AND(Today() -Opportunity.CloseDate <= 10, 
Opportunity.childcount__c >1) Disply errort message and make one check box field as True.

4)now write a Standard Email alert based on check box field. if it is true send mail with the desired field you want.


 
NNRNNR
HI Satheesh,
2)Then user try to create the next child record within 10 days salemanger will get mail with the Opportunity deatils am i correct?
User not create child record my closedate+10days then salesmanager will receive email,still ur sales not created child record.without creating any new field .if user can create no problem if not created then sent mail
 
atla satheeshkumaratla satheeshkumar
Hi NNR,

2)yes.

Do you want to send mail to salesmanager after 11 days daily am i corrcet.
atla satheeshkumaratla satheeshkumar
if yes write a schedule apex to send mail daily
atla satheeshkumaratla satheeshkumar
Take 2 conditions to send mail in schedule apex take closeDate and Today.if it is more then 10 days .start sending mail to salesmanager Daily
NNRNNR
Hi satheesh,
yes,with opportunity details like table name,accountnumber,staus,closedate.we need to send