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

Format Date while importing it to a customproperty

KrishnaGupta
New Contributor III
New Contributor III

Hi All,

We are importing users via a REST connector. As part of the user import we are getting a date field in the format YYYYMMDD and this is mapped to a user customproperty. We the format of the date to be YYYY-MM-DD.
I have tried various combinations however it has not worked so far. Please share how date can be formatted while importing users.

configurations tried so far :
1. "globalSettings": {
"dateFormat": "yyyy-MM-dd"
}

2. "customproperty16":"${new java.text.SimpleDateFormat('yyyy-MM-dd').format(response.date)}~#~date"

3. "customproperty16":"${new Date(response.date).format('yyyy-MM-dd')}~#~date" } }


Regards,
Krishna Gupta

11 REPLIES 11

PremMahadikar
All-Star
All-Star

Hi @KrishnaGupta ,

${Date.parse('yyyyMMdd',response.date).format('yyyy-MM-dd')}

Refer article: Re: how to convert string into date in AD and Rest... - Saviynt Forums - 96297

 

If this helps, please select Accept As Solution and hit Kudos

This format also didn't work

${Date.parse('yyyyMMdd',response.date).format('yyyy-MM-dd')}

Raghu
All-Star
All-Star

@KrishnaGupta  please check below article :

https://forums.saviynt.com/t5/application-access-governance/rest-connector-query-issue-with-importin...

 


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

KrishnaGupta
New Contributor III
New Contributor III

I have already tried this solution by adding the format in global settings and updating the type to date.
However it doesn't work, probably because the article is regarding account import and the requirement is is to update date format from trusted source during user import.

rushikeshvartak
All-Star
All-Star

"customproperty30": "#CONST#${new Date(Calendar.getInstance().getTimeInMillis()).format('yyyy-MM-dd hh:mm:ss')}~#~char",


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

This would give the current date, however the requirement is to update date format from trusted source.

"customproperty30": "#CONST#${new Date(response.date.time).format('yyyy-MM-dd hh:mm:ss')}~#~char",


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

Manu269
All-Star
All-Star

@KrishnaGupta check this post :

Solved: Converting Date Format in Rest Connector Account I... - Saviynt Forums - 81520

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

KrishnaGupta
New Contributor III
New Contributor III

Adding date format in global settings in the JSON didn't work.

KrishnaGupta
New Contributor III
New Contributor III

I tried this as well:


"customproperty16": "#CONST#${SimpleDateFormat simpleformat = new SimpleDateFormat(\"yyyy-MM-dd\"); return simpleformat.format(response.date)}~#~char"


What ends up happening is that the value of customproperty16 will end up being this:
#CONST#${SimpleDateFormat simpleformat = new SimpleDateFormat(\"yyyy-MM-dd\"); return simpleformat.format(response.date)}

@KrishnaGupta  try

"customproperty30": "#CONST#${new java.text.SimpleDateFormat('yyyy-MM-dd').format(new Date(response.date))}~#~date"


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.