Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

UTC Date Format for Rest Connector

AshishDas
Regular Contributor II
Regular Contributor II

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

8 REPLIES 8

sudeshjaiswal
Saviynt Employee
Saviynt Employee

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,

If you find the above response useful, Kindly Mark it as "Accept As Solution".

AshishDas
Regular Contributor II
Regular Contributor II

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()

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @AshishDas ,

You may try this,
{
"url": "https://xxxxxx/Oracle/Common/GetEmployeeDataforSaviynt_LastUpdatedDateTime?lastUpdatedDate=${Calenda..."
}

Thanks,

 

 
If you find the above response useful, Kindly Mark it as "Accept As Solution".

AshishDas
Regular Contributor II
Regular Contributor II

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?

Can you try below to subtract 2 hours?

${Calendar.getInstance().add(Calendar.HOUR,-2).getTime().format(\"yyyy-MM-dd'T'HH:mm:ss'Z'\")}

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

AshishDas
Regular Contributor II
Regular Contributor II

Hi Naveen,

This is not working. It is not resolving to the date 2 hours minus.

sudeshjaiswal
Saviynt Employee
Saviynt Employee

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,

If you find the above response useful, Kindly Mark it as "Accept As Solution".

ChrisBellobuono
New Contributor III
New Contributor III

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.