Thank you very much! I am getting closer to my final goal, that's awesome.
I have a couple of questions.
1. I don't understand when I have to use a specific Pega syntax, like @(Pega-RULES:DateTime).getCurrentDateStamp() or a (Java I guess) function is enough CurrentDateTime()
2. Is there a way to add logic (IF.. THEN.. or local Varialbles) into the Expression Builder? While your code works like a charm, it's a bit static (I have to know the current day to subtract the exact number of days to get to Monday), with some IF... THEN... and local Variables i can make it dynamic.
1. For me it worked with CurrentDateTime() itself in expression builder opened from data transform. I opened expression builder from Data Transform and did browse and added CurrentDateTime(). You can test once whether CurrentDateTime() is working for you and if not change it to @(Pega-RULES:DateTime).getCurrentDateStamp().
2. My code should work for any day. If we run the code on any day, result will be that week Monday. We don't have to do separate if else condition for different days.
Please see screenshot below executing same code today (Friday) and getting result as last Monday. I executed same code yesterday and got result as last Monday.