• Joshua Rood
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Been tinkering with FullCalendar the last few weeks and am now using it to set up an opportunity calendar based on close date. I have it set up so opportunities (events) can be dragged to a different date, and I'd like that action to update the close date of the opp. I've been digging around and trying various format and date methods, but have had no luck. Below is the pertinent snippet of code and I'd appreciate any input. I know there's a ton out there regarding string to date conversions and date formatting, but after hours of research, I just can't seem to find the right mixture.

For refernece, event.id and event.start are both Strings.

On VF Page:
eventDrop: function(event) {
    updateCD(event.id,event.start);
},

In Controller:
 
public PageReference updateCD(String id, String dropDate) {
    Date newDate = date.parse(dropDate);
    
    for(Opportunity o : [select Id, CloseDate from Opportunity where Id=:id]) {
        o.CloseDate = newDate;
        update o;
    }
return null;
}
Been tinkering with FullCalendar the last few weeks and am now using it to set up an opportunity calendar based on close date. I have it set up so opportunities (events) can be dragged to a different date, and I'd like that action to update the close date of the opp. I've been digging around and trying various format and date methods, but have had no luck. Below is the pertinent snippet of code and I'd appreciate any input. I know there's a ton out there regarding string to date conversions and date formatting, but after hours of research, I just can't seem to find the right mixture.

For refernece, event.id and event.start are both Strings.

On VF Page:
eventDrop: function(event) {
    updateCD(event.id,event.start);
},

In Controller:
 
public PageReference updateCD(String id, String dropDate) {
    Date newDate = date.parse(dropDate);
    
    for(Opportunity o : [select Id, CloseDate from Opportunity where Id=:id]) {
        o.CloseDate = newDate;
        update o;
    }
return null;
}
Been tinkering with FullCalendar the last few weeks and am now using it to set up an opportunity calendar based on close date. I have it set up so opportunities (events) can be dragged to a different date, and I'd like that action to update the close date of the opp. I've been digging around and trying various format and date methods, but have had no luck. Below is the pertinent snippet of code and I'd appreciate any input. I know there's a ton out there regarding string to date conversions and date formatting, but after hours of research, I just can't seem to find the right mixture.

For refernece, event.id and event.start are both Strings.

On VF Page:
eventDrop: function(event) {
    updateCD(event.id,event.start);
},

In Controller:
 
public PageReference updateCD(String id, String dropDate) {
    Date newDate = date.parse(dropDate);
    
    for(Opportunity o : [select Id, CloseDate from Opportunity where Id=:id]) {
        o.CloseDate = newDate;
        update o;
    }
return null;
}