I need to create a Task with a due date for the last day of the current month

I have seen articles on Report schedules to run on the end of a month, but no articles about specific Due Dates at the end on the month.

Parents
  • Hi Robert McAnally,

    PHP can handle the concept of "current month" rather well with custom code, but there is not much that comes to mind regarding how one would set a value to the last day of the current month in a date field using calculated fields or SugarBPM.

    If the due date can afford to be the last possible moment of the month, a workaround that Sugar's user interface supports simply can be the first minute of the next month, which is comparable.

    If it needs to be the last day of the month, and so the above does not work, a logic hook coded in PHP should be able to handle generating the date you need and populating the date accordingly. Here is a link to a discussion on this topic.

    I hope this helps!

  • Thanks, Patrick!

    However, I think I am missing something in the 2nd paragraph:  I am trying to create a Process Definition where if Task Type = X, then Due Date = first minute of next month...all I see in Constants are Fixed Date and Time Span.  Am I missing something?

    Rob McAnally

    CRM Administrator

Reply Children
  • Hi Robert McAnally,

    You are correct that SugarBPM is much more limited in this capacity. When I give the thoughts in my head a minute to process around how I would do this in Sugar without custom code, it turns into a Rube Goldberg machine of calculated fields and whatnot, which I could not in good faith recommend to any administrator. I should have been more thoughtful before my initial response. I believe the most efficient solution here considering the core product's capabilities and limitations is a simple logic hook that only triggers in specified scenarios to set the Due Date as needed.

    For example of one way I might handle this: I might make a checkbox, have the process check the checkbox, then have the logic hook run only when the record is being created and the checkbox is checked, having the logic hook set the field to the last day of the current month as desired.