how to set recurrence trigger for every second tuesday in a month

Sai Kiran Palivela 41 Reputation points
2022-09-23T07:40:42.617+00:00

Hi all,

I'm not able to set a recurrence trigger, which should send an email on every second tuesday of the month in a logic app. I tried to set interval -4 and frequency- weekly and added a new parameter "On these days" - set to tuesday. However, after two months, the logic app will run on first week of the month.
244173-image.png

Appreciate the help!!

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Alistair Ross 7,471 Reputation points Microsoft Employee
    2022-09-23T22:54:16.52+00:00

    Hello @Sai Kiran Palivela

    I looked at this question earlier today and thought "I know there isn't a built in parameter for this but I've written a query in Kusto Query Language that achieves the same thing, building an expression should be a walk in the park!". While I had all the logic in place from this previous query, I had to translate this into an expression with Logic Apps.

    Here is my basic logic app that runs once a week (you can have it run every day if you really want). If the day it runs on matches the intended day (in this case 2 for Tuesday) and the intended week (once again, 2 for the second Tuesday of the month) then it returns true, otherwise it will be false. This does mean that the logic app needs to run the trigger at least once a week on the Tuesday, but the condition statement will evaluate and terminate the workflow if it isn't the second Tuesday of the month.

    244349-question1020368-01.png

    I've provided a copy of the logic app for you to test / copy https://github.com/TheAlistairRoss/AzureMonitor/blob/main/LogicApps/DayOfTheMonthTrigger/template.json

    If you want the expression found in the Condition statement, it is

    if(equals(startOfDay(addDays(if(less(addDays(addDays(startOfMonth(utcNow()), int(concat('-',dayOfWeek(startOfMonth(utcNow()))))),int(variables('Constants').DayOfWeek)), startOfMonth(utcNow())),addDays(addDays(addDays(startOfMonth(utcNow()), int(concat('-',dayOfWeek(startOfMonth(utcNow()))))),int(variables('Constants').DayOfWeek)),7), addDays(addDays(startOfMonth(utcNow()), int(concat('-',dayOfWeek(startOfMonth(utcNow()))))), int(variables('Constants').DayOfWeek))),mul(add(int(variables('Constants').WeekOfMonth),-1),7))),startOfDay(utcNow())),true,false)  
    

    kind regards

    Alistair

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.