Set a date based on a Quarter and Year

Here is how you can use the Custom JavaScript pipe › Moment.js call to set a date field based on what Quarter and Year are set and use that to update a…

  • Not yet re-checked
  • Classic builder

Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

Screenshot for “Set a date based on a Quarter and Year”

Here is how you can use the Custom JavaScript pipe > Moment.js call to set a date field based on what Quarter and Year are set and use that to update a Status field.

Step 1

Install the Custom JavaScript pipe. Within the API Calls of the pipe, set up the parameters as shown in the image below.

Screenshot for “Set a date based on a Quarter and Year”

Step 2

Within the Request tab of the API calls, add the following code.

Text
var outputDate;
if ('{quarter}' === 'Q1') {
    outputDate = moment('{year}-03-31').format('L');
} else if ('{quarter}' === 'Q2') {
    outputDate = moment('{year}-06-30').format('L');
} else if ('{quarter}' === 'Q3') {
    outputDate = moment('{year}-09-30').format('L');
} else {
    outputDate = moment('{year}-12-31').format('L');
}

outputDate
Screenshot for “Set a date based on a Quarter and Year”

Step 3

Set the following table rules when a record is "created or edited."

#1

Screenshot for “Set a date based on a Quarter and Year”

#2

Screenshot for “Set a date based on a Quarter and Year”

#3

Screenshot for “Set a date based on a Quarter and Year”

Original Community Post:

Set a date based on a Quarter and Year - Community Discussions / Pipes - Tadabase Community

Was this page helpful?

Something wrong or missing on this page? Tell us.