• MjrAdmin
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

We have Accounts that have reoccurring Opportunities, I want to know the number of days between these Orders for the accounts they are related to, other companies must want to know the same thing, has anyone accomplished this, if so how, a matrix report to group it but can't calculate the days?

I have a custom Object: Milsetone__c, (it is a Child of custom Object: Project__c), I want to create a new Milestone record when the current Milestone Record that has a Project_Stage__c = 'Pre-construction Engineering' and a checkbox field called: Complete__c = true.  In my sandbox it just updates the exisitng record, does not create new record?  I need help I've written several triggers, but none like this - same Object/new record, 

 

 

trigger MilestoneZoning on Milestone__c (after insert) {

List<Milestone__c>newMilestones = new List<Milestone__c>();

for(Milestone__c ms :trigger.new) {

if( (ms.Name == 'Pre-construction Engineering Milestone')
&& (ms.Complete__c == True)){
Milestone__c freshMilestone = new Milestone__c();
freshMilestone.Name = 'Pre-construction Zoning Milestone';
freshMilestone.Opportunity__c = ms.opportunity__c;
freshMilestone.Project_Stage__c = 'Pre-construction Zoning';
freshMilestone.Project__c = ms.Project__c;
freshMilestone.Project_Manager__c = ms.Project_Manager__c;


newMilestones.add(freshMilestone);

}
}

Insert newMilestones;
}

I have a custom Object: Milsetone__c, (it is a Child of custom Object: Project__c), I want to create a new Milestone record when the current Milestone Record that has a Project_Stage__c = 'Pre-construction Engineering' and a checkbox field called: Complete__c = true.  In my sandbox it just updates the exisitng record, does not create new record?  I need help I've written several triggers, but none like this - same Object/new record, 

 

 

trigger MilestoneZoning on Milestone__c (after insert) {

List<Milestone__c>newMilestones = new List<Milestone__c>();

for(Milestone__c ms :trigger.new) {

if( (ms.Name == 'Pre-construction Engineering Milestone')
&& (ms.Complete__c == True)){
Milestone__c freshMilestone = new Milestone__c();
freshMilestone.Name = 'Pre-construction Zoning Milestone';
freshMilestone.Opportunity__c = ms.opportunity__c;
freshMilestone.Project_Stage__c = 'Pre-construction Zoning';
freshMilestone.Project__c = ms.Project__c;
freshMilestone.Project_Manager__c = ms.Project_Manager__c;


newMilestones.add(freshMilestone);

}
}

Insert newMilestones;
}