Crow Canyon Software Forum

Forum Navigation
Please or Register to create posts and topics.

Checking for last or first of month

We could use a way to check if a given date (calculated and set as variable) is the first or last (or neither) day of the date's given month. Is there currently a way to accomplish that I'm just missing?

-Thanks

Hi @davisa,

Please provide more details on where you need it - NITRO Forms, Custom Actions or Workflows? Also, provide column details and little bit more on the sceanario so that we can check.

Regards
Crow Canyon Team.

Absolutely, my apologies. This would be used in a workflow and would be utilizing datetime fields

Use case is a task list used to assign a review of data of a given 6 mos period. Initial tasks for a given client will be created manually and a follow up task needs to be created by workflow after a given task is complete. A given task's data review period (6 mos) is defined with a Review Period Start Date datetime field and a Review Period End Date datetime field. A task's Review Period Start Date needs to always start on the 1st of a given month and it's Review Period End Date needs to always end on the last day of the following 6th month (e.g. Review Period Start Date: January 1 - Review Period End Date: June 3o).

We want to be able to ensure that the workflow is creating the task on the 1st day of a given month (calculated as the [previous task's review period end date] + 1 day). So for our example of Jan 1 - June 30, the follow up task would need to be created on July 1.

Our concern is if something were to happen and the dates were to get off, there would be know way to catch the error and get the task back on track (e.g. if ([previous task's review period end date] + 1 day does not equal the 1st day of the following month) {get the 1st day of the following month})

Thanks for the details. This can be configured with following steps:

  • Initial tasks are created manually and have proper start and end date for review period. Subsequent tasks just need to follow the next six month period with correct start and end dates of respective months.
  • Configure a timer based workflow to run 30 minutes after the end date column for the task list. This way workflow will run on the date matching with review period end date.
  • This workflow will create the task for next period:
    • Add a create item action to the workflow for the same tasks list.
    • In column mapping for dates, use the function 'addmonths' to add six months to the start date (and same for the end date).
    • Add mapping for other columns of the task list.
  • If required, you can add a column in task to track if the next period task has been created or not. This could be a Yes/No column with initial/default value as 'No'. Add an action in above workflow to set this value to 'Yes' after the next period task is created. In timer workflow, we can add a condition to fetch only those tasks where this value is 'No'. After this you can add a repeat to the timer task (run after 30 minutes and say 3 times). This will ensure that there is a backup repeat workflow to ensure that next task gets created. Please refer to this link for configuring timer based workflow: https://www.crowcanyon.info/nitro/appmanual_v2/configuring-workflows.html
DavisA has reacted to this post.
DavisA

Thanks!