06/08/2023 12:14 AM
Hi,
We are trying to pull data via rest connector for increment user import. However, the lastupdatedate format which we have in the target is in UTC format and we aren't able to resolve the new Date function in Saviynt.
Below is the url, which we have in UserImportJson:
"url": "https://xxxxxx/Oracle/Common/GetEmployeeDataforSaviynt_LastUpdatedDateTime?lastUpdatedDate=${(new Date()).format('YYYY-MM-DDTHH:mm:00.00')}&personNumber=1004226"
The value {(new Date()).format('YYYY-MM-DDTHH:mm:00.00')} is not resolving and we are getting an error.
However, when we use the date format as {(new Date()).format('YYYY-MM-DD')} in the url, it works.
But we would want a date format similar to '2023-06-08T03:30:00.11' .
Any help would be appreciated.
2023-06-08T12:23:03
Solved! Go to Solution.
06/08/2023 01:13 AM - edited 06/08/2023 01:47 AM
Hello @AshishDas,
Can you please try with the below date format,
${Calendar.getInstance().getTime().format(\"yyyy-MM-dd'T'HH:mm:ss'Z'\")}",
Also, please do not use (new Date()) as it has been deprecated by Saviynt.
Thanks,
06/08/2023 03:32 AM - edited 06/08/2023 03:32 AM
Hi Sudesh,
Thanks for the info. Could you tell me the solution if I need to minus/substract two hours from the . What needs to be written in the function Calendar.getInstance().getTime()
06/08/2023 07:39 AM - edited 06/08/2023 07:40 AM
Hello @AshishDas ,
You may try this,
{
"url": "https://xxxxxx/Oracle/Common/GetEmployeeDataforSaviynt_LastUpdatedDateTime?lastUpdatedDate=${Calenda..."
}
Thanks,
06/08/2023 09:45 PM
Hi Sudesh,
Thank you for the effort. However, the url is not visible in your above reply. Hovering over the url gives me the following value:
"url":"https://xxxxxx/Oracle/Common/GetEmployeeDataforSaviynt_LastUpdatedDateTime?lastUpdatedDate=${Calendar.getInstance().getTime().format(%27yyyy-MM-dd%27T%27HH:mm:ss.SSS%27Z%27%27)}&personNumber=1004226",
This is not resolving in saviynt and throws an error. Could you tell me how you are subtracting 2 hours in the above url?
06/09/2023 12:10 AM
Can you try below to subtract 2 hours?
${Calendar.getInstance().add(Calendar.HOUR,-2).getTime().format(\"yyyy-MM-dd'T'HH:mm:ss'Z'\")}
06/09/2023 01:01 AM
Hi Naveen,
This is not working. It is not resolving to the date 2 hours minus.
06/09/2023 04:22 AM
Hello @AshishDas
{
"url": "https://xxxxxx/Oracle/Common/GetEmployeeDataforSaviynt_LastUpdatedDateTime?lastUpdatedDate=${Calenda..., -2).getTime().format('yyyy-MM-dd'T'HH:mm:ss.SSS'Z'')}&personNumber=1004226"
}
This will subtract 2 hours from the current time and use that as the value for the lastUpdatedDate parameter.
Thanks,
08/11/2023 06:30 AM
I do not know if you have solved your problem already, but the recommendations listed above for adjusting the date are not correct. Calendar's add(...) method returns a void type, so the calls cannot be chained together as suggested in this and other posts. Instead, your script needs to look like this:
${Calendar c=Calendar.getInstance();c.add(Calendar.HOUR,-2);c.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")}
Hope that helps.