Help

Re: Automation incl. finding amount of date(s) between 2 dates recognition

136 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Marika_Vallier
6 - Interface Innovator
6 - Interface Innovator

Hello!

Let me first paint the picture of what I am working with:

1 base, 4 tabs: "🧍‍♀️People", "🏝️ Absence Management", "🏝️ Leave types" and "📅 Public holidays"

Relevant columns:

  • In "🧍‍♀️People" one column has the staff "Name" and the other column has a "Leave Location" (which refers to the location they are based in and to which public leave should be based on)
  • In "🏝️ Leave types", we have a choice of "Leave" called: "🌞 Holiday", "🗓️ Public Holiday", "🌞🗓️ Holiday + Public Holiday", "🤒 Sick".
  • In "🏝️ Absence Management", we have date fields with leave "Start Date" and "End Date", linked fields to "🧍‍♀️People" taking "Name" and look up "Leave Location", linked field to "🏝️ Leave types"
  • In "📅 Public holidays" we have a first field which is a formula of date + "Name" of the public leave, then a "Date" field, a multiple select "Leave Location" field.

What I want is that each time someone submit a Leave Form (linked to "🏝️ Absence Management"), the automation:

  1. Checks whether "📅 Public holidays"' any of the records' "Leave Location" is the same as the one of the person who submitted it.
  2. If yes, then it should check if the date of the record in " 📅 Public holidays" is comprised between "Start Date" and "End Date" of the Leave requested.
  3. If yes, then it should input the amount of public holiday days in a dedicated field called "Public Holiday included" and if possible, even add the matches to the "Public holiday" linked field in "🏝️ Absence Management" (in fact, if we can make the later happen then we could just have a count field!)

In a second step, I would want that if:

  • if public holiday leave = 0 → an actionable message in sent on Slack to ask for approval for the leave.

  • if public holiday leave < leave asked and is not = 0 → change the linked record to "🌞🗓️ Holiday + Public Holiday" + send an actionable message in sent on Slack to ask for approval for the leave.

  • if public leave = leave asked → change the linked record to "🌞🗓️ Holiday + Public Holiday" + approve 

To approve, the same name selected by the leave requester as the "Approver/s" (which is a linked record to "🧍‍♀️People" in "🏝️ Absence Management") needs to be selected in a collaborator field called "✍🏽 Approved by"

I have been battling with scripts and ChatGPT for a while now and would be grateful for anyone support if you are up to the challenge 🙏 (video attached)

1 Reply 1

Hey @marikay

I recommend solving it with script and ChatGPT is the best way to generate the code you need. This is how I work also 🙂 

Did you try to build the script step by step? Really interested in helping you with this quick challenge, please feel free to dm me with no commitment of course, to see how to prompt step by step on GPT and complete the automation