# Dynamically change filter in Get Pending Access requests

**URL:** <https://developer.sailpoint.com/discuss/t/dynamically-change-filter-in-get-pending-access-requests/16402>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, apis, identity-security-cloud\
**Created:** [August 22, 2023, 8:38am UTC](https://developer.sailpoint.com/discuss/t/dynamically-change-filter-in-get-pending-access-requests/16402 "2023-08-22T08:38:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nadim](https://avatars.discourse-cdn.com/v4/letter/n/9dc877/32.png) [@Nadim](https://developer.sailpoint.com/discuss/u/Nadim)\
**Post date:** [August 22, 2023, 8:38am UTC](https://developer.sailpoint.com/discuss/t/dynamically-change-filter-in-get-pending-access-requests/16402/1 "2023-08-22T08:38:15Z")

</div>

Hello,  
I am trying to create a workflow and in that workflow I use the “ **Get Pending Access Requests** ” action. On this action we have the possibility to filter results.

What I am trying to do is get pending requests that haven’t been modified for exactly 7 days prior to when the workflow runs. If we take today (22 august ) as an example the filter I would put would be filters = modified lt 2023-08-16 and modified gt 2023-08-14.

The behavior I want is for the filter dates to change, so I can have the pending requests that haven’t been modified for 7 days each time. what I have in mind is something like filters = modified lt now-6d and modified gt now-8d. is there a way to have a filter like that?

If not what can I intergrate in my workflow to have new dates each time that I will use in my filter

Thank you in advance

---

<div class="post-metadata">

**Author:** ![colin\_mckibben](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/colin_mckibben/32/37182_2.png) [@colin\_mckibben](https://developer.sailpoint.com/discuss/u/colin_mckibben)\
**Post date:** [August 31, 2023, 1:47pm UTC](https://developer.sailpoint.com/discuss/t/dynamically-change-filter-in-get-pending-access-requests/16402/2 "2023-08-31T13:47:38Z")

</div>

You can use the `$.now()` function in a Define Variable operator to get the current time when the workflow runs. You can then reference that variable in your filter. Check out this post for more information on using `$.now()`.

> [@getDay in Workflow](https://developer.sailpoint.com/discuss/t/getday-in-workflow/15795/2):
>
> Hi Aditi. $.now() produces a timestamp in the following format: yyyy-mm-ddThh:mm:ssZ. An actual value will look like this: 2023-08-22T19:28:38.698Z. You can get the current day of the month by using the substring operator in your define variable step. Set the “Starts From” value to 8, and the “Length” to 2. That will produce a variable that will just have the day of the month. So for a date of 2023-08-22T19:28:38.698Z, the variable will produce the value 22.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [October 30, 2023, 1:47pm UTC](https://developer.sailpoint.com/discuss/t/dynamically-change-filter-in-get-pending-access-requests/16402/3 "2023-10-30T13:47:47Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
