Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

ImportUserJSON date calculation in URL

Huddos
Regular Contributor
Regular Contributor

Hi,

Is there a way to calculate a date based on (currentdate - X days) as per below for our HR feed connection and ImportuserJSON section.

"url": "https://<url>?terminated_from_date=(currentdate - 120)&limit=50&page=1",

Returned calculation should be yyyy-MM-dd. 

Tried below but failed.

"url": "https://<url>?terminated_from_date=${Calendar.getInstance().(getTimeInMillis()-(120*86400000)).format('yyyy-MM-dd')}&limit=50&page=1"

thanks

 

6 REPLIES 6

rushikeshvartak
All-Star
All-Star

"url": "https://<url>?terminated_from_date=${Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, -120); it.time }.format('yyyy-MM-dd')}&limit=50&page=1"

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi Rushikesh,

What am I doing wrong with this code, doesn't like $ sign. thanks

 

"nextUrl": {
"nextUrlPath": "${response?.objectList?.size()>0?'https://<url>?limit=50&page=' + Math.addExact(response.completeResponseMap.pagination.current_page,1) + '&terminated_from_date=${Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, -120); it.time}.format('yyyy-MM-dd')}':null}"

"nextUrl": {
"nextUrlPath": "${response?.objectList?.size()>0?'https://<url>?limit=50&page=' + Math.addExact(response.completeResponseMap.pagination.current_page,1) + '&terminated_from_date=' + Calendar.getInstance().with { it.add(Calendar.DAY_OF_YEAR, -120); it.time }.format('yyyy-MM-dd') : null}"
}


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Legend, I tried many combinations here didn't realise you don't need the ${} sign for the calendar method. 

Just to reconfirm . Above pagination is working issue was since $ was define outside in starting again its not needed for anything which is dynamic.


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Huddos
Regular Contributor
Regular Contributor

That first option works great, thanks for that