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

Need help to set time in Mulesoft target

pborah
Regular Contributor
Regular Contributor

hi there,

Kindly guide us to convert the startdate, enddate, imdlCreationDate, imdlDeletionDate values to be sent create account script. Tried multiple options as below:

1. ${if(user.enddate!=null){new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(user.enddate)}}

2. {user?.enddate.format('yyyy-MM-dd'T'HH:mm:ssZ')}

3. {new java.text.SimpleDateFormat('yyyy-MM-dd'T'HH:mm:ssZ').format(user.enddate)}

Getting below error:

"message":{"status":400,"message":"/enddate [] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]\n/startDate [] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]\n

Kindly suggest.

 

Regards.

 

25 REPLIES 25

khalidakhter
Saviynt Employee
Saviynt Employee

Hi,

Please try using the below format and confirm if this works.
new java.text.SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\").parse(user.enddate.toString())

 

Thanks

pborah
Regular Contributor
Regular Contributor

Hi,

Thank you for the reply but when used the above format I got below error

 

2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService - Error in processWebservicecom.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"firstName":"${user.firstname}","lastName":"${user.lastname}","cellPhone":"${user.phonenumber}","azureCorporateADAccountName":"${user.customproperty49}","domainAccount":"${user.customproperty60}","employeeId":"${user.employeeId}","endDate":"${new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(user.enddate.toString())}","initials":"${user.customproperty7}","mainIMDLAccount":"${user.customproperty4}","status":"${user.statuskey}","groupname":"Geotab_Global_Fleet_Manager_QAS","groupid":"8005126"}; line: 1, column: 278]
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"firstName":"${user.firstname}","lastName":"${user.lastname}","cellPhone":"${user.phonenumber}","azureCorporateADAccountName":"${user.customproperty49}","domainAccount":"${user.customproperty60}","employeeId":"${user.employeeId}","endDate":"${new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(user.enddate.toString())}","initials":"${user.customproperty7}","mainIMDLAccount":"${user.customproperty4}","status":"${user.statuskey}","groupname":"Geotab_Global_Fleet_Manager_QAS","groupid":"8005126"}; line: 1, column: 278]
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._skipComma(ReaderBasedJsonParser.java:2285)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextFieldName(ReaderBasedJsonParser.java:912)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:505)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:362)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:27)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3814)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2877)
2023-05-30/07:56:42.752 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind.ObjectMapper$readValue.call(

khalidakhter
Saviynt Employee
Saviynt Employee

Hi 

The new keyword is no more supported in any JSON in Saviynt EIC. So you will need to use the Calender function to achieve the requirement.
You can use the below syntax to get the time Zulu time format.

Calendar today=Calendar.getInstance(); today.setTime(user.enddate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")

Or, you can transform the user property directly to convert the timestamp to Zulu time format as below.

user.updatedate.toString().replace(' ','T').concat('00Z')

Please try this solution and update if it works.

pborah
Regular Contributor
Regular Contributor

This time format worked for me and I have added this in the createAccount JSON as below:

\"startDate\":\"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\"

pborah
Regular Contributor
Regular Contributor

Hi,

I am not able to get the correct output with any of the options suggested above because I am unable to fetch any user attributes in the create account JSON under http params. multiple options and nothing worked although similar option works for other rest integrations..

For example for lastName i tried following options.

\"lastName\":\"${user.lastname}\"

\"lastName\":\"${user?.lastname}\"

\"lastName\":\"${user.lastname!=null?user.lastname:''}\"

\"lastName\":\"${user.lastname!=null?user.lastname:null}\"

\"lastName\":\"${user.lastname!=null?user?.lastname:null}\"

Any suggestion will be really helpful.

pborah
Regular Contributor
Regular Contributor

 

Create Account JSON

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": true,
"url": "https://lb-1.eu-west-1.mulesoft-cloudhub-nonprod.pmideep.com:443/dev-siga/v2/applications/${endpoint...",
"httpMethod": "POST",
"httpParams": "{\"status\":\"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}\",\"firstName\":\"${user.firstname!=null?user?.firstname:''}\",\"lastName\":\"${user.lastname!=null?user.lastname:''}\",\"department\":\"${user.jobfunction!=null?user.jobfunction:''}\",\"location\":\"${user.location!=null?user.location:''}\",\"jobCode\":\"${user.jobCode!=nulluser.jobCode:''}\",\"businessPhone\":\"${user.secondaryPhone!=null?user.secondaryPhone:''}\",\"division\":\"${user.entity!=null?user.entity:''}\",\"cellPhone\":\"${user.phonenumber!=null?user.phonenumber:''}\",\"addressLine2\":\"${user.locationdesc!=null?user.locationdesc:''}\",\"title\":\"${user.title!=null?user.title:''}\",\"addressLine1\":\"${user.locationdesc!=null?user.locationdesc:''}\",\"city\":\"${user.city!=null?user.city:''}\",\"displayName\":\"${user.displayname!=null?user.displayname:''}\",\"accountSubType\":\"${user.employeeType!=null:user.employeeType:''}\",\"accountType\":\"${user.customproperty55!=null?user.customproperty55:''}\",\"azureCorporateADAccountName\":\"${user.customproperty49!=null?user.customproperty49:''}\",\"azureIQOSAccountId\":\"${user.customproperty52!=null?user.customproperty52:''}\",\"azureIQOSAccountName\":\"${user.customproperty50!=null?user.customproperty50:''}\",\"companyCode\":\"${user.comapanyname!=null?user.comapanyname:''}\",\"companyCodeName\":\"${user.entity!=null?user.entity:''}\",\"costCenterName\":\"${user.costcenter!=null?user.costcenter:''}\",\"countryISOCode\":\"${user.country!=null?user.country:''}\",\"departmentId\":\"${user.departmentNumber!=null?user.departmentNumber:''}\",\"departmentName\":\"${user.departmentName!=null?user.departmentName:''}\",\"deputy\":\"${user.donotdisturndelegate!=null?user.donotdisturndelegate:''}\",\"domainAccount\":\"${user.customproperty60!=null?user.customproperty60:''}\",\"emailAddress\":\"${user.customproperty61!=null?user.customproperty61+'@pmintl.dev':''}\",\"email\":\"${user.customproperty61!=null?user.customproperty61+'@pmintl.dev':''}\",\"employeeClass\":\"${user.employeeclass!=null?user.employeeclass:''}\",\"employeeId\":\"${user.employeeid!=null?user.employeeid:''}\",\"endDate\":\"2023-05-25T14:04:39Z\",\"functionId\":\"${user.customproperty12!=null?user.customproperty12:''}\",\"functionName\":\"${user.jobcodedesc!=null?user.jobcodedesc:''}\",\"imdlCreationDate\":\"2023-05-25T14:04:39Z\",\"imdlDeletionDate\":\"2023-05-25T14:04:39Z\",\"initials\":\"${user.customproperty7!=null?user.customproperty7:''}\",\"jobName\":\"${user.entity!=null?user.entity:''}\",\"locationNumber\":\"${user.locationnumber!=null?user.locationnumber:''}\",\"mainIMDLAccount\":\"${user.customproperty4!=null?user.customproperty4:''}\",\"manager\":\"${user.manager!=null?user.manager:''}\",\"mobileNumber\":\"${user.phonenumber!=null?user.phonenumber:''}\",\"orgUnitId\":\"${user.orgunitid!=null?user.orgunitid:''}\",\"orgUnitName\":\"${user.customproperty16!=null?user.customproperty16:''}\",\"organization\":\"${user.customproperty3!=null?user.customproperty3:''}\",\"organizationName\":\"${user.customproperty21!=null?user.customproperty21:''}\",\"positionId\":\"${user.customproperty11!=null?user.customproperty11:''}\",\"positionName\":\"${user.title!=null?user.title:''}\",\"postalCode\":\"${user.regioncode!=null?user.regioncode:''}\",\"preferredFirstName\":\"${user.preferredfirstname!=null?user.preferredfirstname:''}\",\"region\":\"${user.region!=null?user.region:''}\",\"startDate\":\"2023-05-25T14:04:39Z\",\"street\":\"${user.street!=null?user.street:''}\",\"subFunctionId\":\"${user.customproperty13!=null?user.customproperty13:''}\",\"subFunctionName\":\"${user.customproperty17!=null?user.customproperty17:''}\",\"userId\":\"${user.customproperty49!=null?user.customproperty49:''}\",\"username\":\"${user.customproperty61!=null?user.customproperty61+'@pmintl.dev':''}\",\"workNumber\":\"${user.secondaryphone!=null?user.secondaryphone:''}\",\"localMiddleName\":\"${user.customproperty10!=null?user.customproperty10:''}\",\"localFirstName\":\"${user.customproperty9!=null?user.customproperty9:''}\",\"localLastName\":\"${user.customproperty8!=null?user.customproperty8:''}\",\"middleName\":\"${user.middlename!=null?user.middlename:''}\",\"legalHoldFlag\":true,\"lineManagerFlag\":true}",
"httpHeaders":
{
"client_id": "9f39b65757b749649f0454cf2cf7601a",
"client_secret": "5C207e1Aeee5491886B4c46ca3e85bdB",
"Authorization":"Basic OWYzOWI2NTc1N2I3NDk2NDlmMDQ1NGNmMmNmNzYwMWE6NUMyMDdlMUFlZWU1NDkxODg2QjRjNDZjYTNlODViZEI="
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
204,
201,
202,
203,
205
]
},
"unsuccessResponses":
{
"statusCode":
[
400,
404
]
}

}
]
}

khalidakhter
Saviynt Employee
Saviynt Employee

Hi,

REST connector will skip all the bindings even if a single is incorrect or invalid. I checked the above JSON and found that there are a few incorrect user properties are used that cause the complete binding failure. There attributes are mentioned below.

Incorrect user attribute -> Correct user attribute
jobfunction -> job_function
comapanyname -> companyname
departmentName -> departmentname
donotdisturndelegate -> doNotDisturbDelegate
preferredfirstname -> preferedFirstName
secondaryphone -> secondaryPhone

Also, Please find the attached JSON with correct binding along with Date binding.

pborah
Regular Contributor
Regular Contributor

Thank you for your response. This worked for me. can you kindly share the complete list of attributes with me. We also need to send the value of below attributes in the respective format and getting errors.

legalHoldFlag and lineManagerFlag as boolean

tried below two options

${if((user?.customproperty5=='YES'){true} else {false}}

${user?.customproperty5!='YES' ? false :true}

Error seen:

response: {
"status": 400,
"message": "/legalHoldFlag expected type: Boolean, found: String",
"type": "APIKIT",
"detail": "/legalHoldFlag expected type: Boolean, found: String",
"timestamp": "2023-06-06T06:22:47",
"id": "8e35f200-0432-11ee-9c46-06222881a5a1"
}

 

Attribute: startDate

Error seen:

{"status":400,"message":"/startDate expected: null, found: String\n/startDate [${user.startDate}] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]

khalidakhter
Saviynt Employee
Saviynt Employee

Hi

Please refer to the syntax below for the boolean attribute conditions.

\"legalHoldFlag\":${user.customproperty5!='YES'? 'false' :'true'}

And the correct syntax for the user's start date is startdate.

All of the user attribute names are listed in our REST Connector Developer Handbook under the Provisioning JSONs section.
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm

pborah
Regular Contributor
Regular Contributor

Hi,

Thank you for response.

If I try \"legalHoldFlag\":${user.customproperty5!='YES'? 'false' :'true'}, this returns string and not boolean as per the target system requirement.

I have tried below options as well but nothing worked

\"lineManagerFlag\":\"${if(user.customproperty5 == \"YES\") {Boolean.parseBoolean(\\\"true\\\")} else {Boolean.parseBoolean(\\\"false\\\")}}\"

 

,\"lineManagerFlag\":\"${if(user.customproperty5 == \"YES\") {Boolean.parseBoolean(user.customproperty5)} else {null}}\"}


\"lineManagerFlag\":\"${if(user.customproperty5 == \"YES\") {JSON.parse(user.customproperty5)} else {true}}\"}

\"lineManagerFlag\":\"${if(user.customproperty5 == \"YES\") {JSON.parse(true)} else {JSON.parse(true)}}\"}
\"legalHoldFlag\":\"${if(user.customproperty20 == \"YES\") {JSON.parse(true)} else {JSON.parse(true)}}\"}\"${if(user.customproperty5 == \"YES\") {user.customproperty5 === \"true\"} else {user.customproperty5 === \"false\"}}

I get below error:

2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","firstName":"${user?.firstname}","lastName":"${user?.lastname}","department":"${user.job_function}","location":"${user.location}","jobCode":"${user.jobCode}","businessPhone":"${user.secondaryPhone}","division":"${user.entity}","addressLine2":"${user.locationdesc}","title":"${user.title}","addressLine1":"${user.locationdesc}","city":"${user.city}","displayName":"${user.displayname}","accountSubType":"${user.employeeType}","accountType":"${user.customproperty55}","azureCorporateADAccountName":"${user.customproperty49}","azureIQOSAccountId":"${user.customproperty50}","azureIQOSAccountName":"${user.customproperty50}","companyCode":"${user.companyname}","companyCodeName":"${user.entity}","costCenterName":"${user.costcenter}","countryISOCode":"${user.country}","departmentId":"${user.departmentNumber}","departmentName":"${user.departmentname}","deputy":"${user.doNotDisturbDelegate}","domainAccount":"${user.customproperty60}","emailAddress":"${user.customproperty61+'@pmintl.dev'}","email":"${user.customproperty61+'@pmintl.dev'}","employeeClass":"${user.employeeclass}","employeeId":"${user.employeeid}","endDate":"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","functionId":"${user.customproperty12}","functionName":"${user.jobcodedesc}","imdlCreationDate":null,"imdlDeletionDate":null,"initials":"${user.customproperty7}","jobName":"${user.entity}","locationNumber":"${user.locationnumber}","mainIMDLAccount":"${user.customproperty4}","manager":"${user.manager}","mobileNumber":"${user.phonenumber}","orgUnitId":"${user.orgunitid}","orgUnitName":"${user.customproperty16}","organization":"${user.customproperty3}","organizationName":"${user.customproperty21}","positionId":"${user.customproperty11}","positionName":"${user.title}","postalCode":"${user.regioncode}","preferredFirstName":"${user.preferedFirstName}","region":"${user.region}","startDate":"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","street":"${user.street}","subFunctionId":"${user.customproperty13}","subFunctionName":"${user.customproperty17}","userId":"${user.customproperty49}","username":"${user.customproperty61+'@pmintl.dev'}","workNumber":"${user.secondaryPhone}","localMiddleName":"${user.customproperty10}","localFirstName":"${user.customproperty9}","localLastName":"${user.customproperty8}","middleName":"${user.middlename}","legalHoldFlag":"${user.customproperty20=="YES"? Boolean.parseBoolean(\"true\") : Boolean.parseBoolean(\"false\")}","lineManagerFlag":"${user.customproperty5=="YES"? Boolean.parseBoolean(\"true\") : Boolean.parseBoolean(\"false\")}"}; line: 1, column: 1339]
2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)
2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._skipComma(ReaderBasedJsonParser.java:2285)
2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextFieldName(ReaderBasedJsonParser.java:912)
2023-06-07/17:24:12.974 [{}] [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.databind

I was able to get the startdate and endate converted as per my requirement with below code

\"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\"

But for imdlcreationdate this does not work. The date format for this field is yyyy-MM-dd and I get following error:

2023-06-07/20:30:19.709 [{}] [quartzScheduler_Worker-1] DEBUG println.PrintlnToLogger - Println :: | Error com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","firstName":"${user?.firstname}","lastName":"${user?.lastname}","department":"${user.job_function}","location":"${user.location}","jobCode":"${user.jobCode}","businessPhone":"${user.secondaryPhone}","division":"${user.entity}","addressLine2":"${user.locationdesc}","title":"${user.title}","addressLine1":"${user.locationdesc}","city":"${user.city}","displayName":"${user.displayname}","accountSubType":"${user.employeeType}","accountType":"${user.customproperty55}","azureCorporateADAccountName":"${user.customproperty49}","azureIQOSAccountId":"${user.customproperty50}","azureIQOSAccountName":"${user.customproperty50}","companyCode":"${user.companyname}","companyCodeName":"${user.entity}","costCenterName":"${user.costcenter}","countryISOCode":"${user.country}","departmentId":"${user.departmentNumber}","departmentName":"${user.departmentname}","deputy":"${user.doNotDisturbDelegate}","domainAccount":"${user.customproperty60}","emailAddress":"${user.customproperty61+'@pmintl.dev'}","email":"${user.customproperty61+'@pmintl.dev'}","employeeClass":"${user.employeeclass}","employeeId":"${user.employeeid}","endDate":"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","functionId":"${user.customproperty12}","functionName":"${user.jobcodedesc}","imdlCreationDate":"${if (user.customproperty58!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","imdlDeletionDate":"${if (user.customproperty56!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","initials":"${user.customproperty7}","jobName":"${user.entity}","locationNumber":"${user.locationnumber}","mainIMDLAccount":"${user.customproperty4}","manager":"${user.manager}","mobileNumber":"${user.phonenumber}","orgUnitId":"${user.orgunitid}","orgUnitName":"${user.customproperty16}","organization":"${user.customproperty3}","organizationName":"${user.customproperty21}","positionId":"${user.customproperty11}","positionName":"${user.title}","postalCode":"${user.regioncode}","preferredFirstName":"${user.preferedFirstName}","region":"${user.region}","startDate":"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","street":"${user.street}","subFunctionId":"${user.customproperty13}","subFunctionName":"${user.customproperty17}","userId":"${user.customproperty49}","username":"${user.customproperty61+'@pmintl.dev'}","workNumber":"${user.secondaryPhone}","localMiddleName":"${user.customproperty10}","localFirstName":"${user.customproperty9}","localLastName":"${user.customproperty8}","middleName":"${user.middlename}","legalHoldFlag":true,"lineManagerFlag":false}; line: 1, column: 1339]
2023-06-07/20:30:19.709 [{}] [quartzScheduler_Worker-1] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
2023-06-07/20:30:19.709 [{}] [quartzScheduler_Worker-1] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
2023-06-07/20:30:19.709 [{}] [quartzScheduler_Worker-1] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)
2023-06-07/20:30:19.709 [{}] [quartzScheduler_Worker-1] DEBUG p

Please share your latest JSON to have a look.

pborah
Regular Contributor
Regular Contributor

Hi,

PFB JSON

{
  "accountIdPath": "accountName",
  "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX", 
  "call": [
    {
      "name": "call1",
      "connection": "acctAuth",
  "showResponse": true,
      "httpMethod": "POST",
      "httpParams": "{\"status\":\"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}\",\"firstName\":\"${user?.firstname}\",\"lastName\":\"${user?.lastname}\",\"department\":\"${user.job_function}\",\"location\":\"${user.location}\",\"jobCode\":\"${user.jobCode}\",\"businessPhone\":\"${user.secondaryPhone}\",\"division\":\"${user.entity}\",\"addressLine2\":\"${user.locationdesc}\",\"title\":\"${user.title}\",\"addressLine1\":\"${user.locationdesc}\",\"city\":\"${user.city}\",\"displayName\":\"${user.displayname}\",\"accountSubType\":\"${user.employeeType}\",\"accountType\":\"${user.customproperty55}\",\"azureCorporateADAccountName\":\"${user.customproperty49}\",\"azureIQOSAccountId\":\"${user.customproperty50}\",\"azureIQOSAccountName\":\"${user.customproperty50}\",\"companyCode\":\"${user.companyname}\",\"companyCodeName\":\"${user.entity}\",\"costCenterName\":\"${user.costcenter}\",\"countryISOCode\":\"${user.country}\",\"departmentId\":\"${user.departmentNumber}\",\"departmentName\":\"${user.departmentname}\",\"deputy\":\"${user.doNotDisturbDelegate}\",\"domainAccount\":\"${user.customproperty60}\",\"emailAddress\":\"${user.customproperty61+'@pmintl.dev'}\",\"email\":\"${user.customproperty61+'@pmintl.dev'}\",\"employeeClass\":\"${user.employeeclass}\",\"employeeId\":\"${user.employeeid}\",\"endDate\": ,\"functionId\":\"${user.customproperty12}\",\"functionName\":\"${user.jobcodedesc}\",\"imdlCreationDate\":\"${if (user.customproperty58!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"imdlDeletionDate\":\"${if (user.customproperty56!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"initials\":\"${user.customproperty7}\",\"jobName\":\"${user.entity}\",\"locationNumber\":\"${user.locationnumber}\",\"mainIMDLAccount\":\"${user.customproperty4}\",\"manager\":\"${user.manager}\",\"mobileNumber\":\"${user.phonenumber}\",\"orgUnitId\":\"${user.orgunitid}\",\"orgUnitName\":\"${user.customproperty16}\",\"organization\":\"${user.customproperty3}\",\"organizationName\":\"${user.customproperty21}\",\"positionId\":\"${user.customproperty11}\",\"positionName\":\"${user.title}\",\"postalCode\":\"${user.regioncode}\",\"preferredFirstName\":\"${user.preferedFirstName}\",\"region\":\"${user.region}\",\"startDate\":\"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"street\":\"${user.street}\",\"subFunctionId\":\"${user.customproperty13}\",\"subFunctionName\":\"${user.customproperty17}\",\"userId\":\"${user.customproperty49}\",\"username\":\"${user.customproperty61+'@pmintl.dev'}\",\"workNumber\":\"${user.secondaryPhone}\",\"localMiddleName\":\"${user.customproperty10}\",\"localFirstName\":\"${user.customproperty9}\",\"localLastName\":\"${user.customproperty8}\",\"middleName\":\"${user.middlename}\",\"legalHoldFlag\":"comment: boolean value to be added",\"lineManagerFlag\":"comment: boolean value to be added"}",
      "httpHeaders": 
  {
        "client_id": "test",
"client_secret": "test",
"Authorization":"Basic OWYzOWI2NTc1N2I3NDk2NDlmMDQ1NGNmMmNmNzYwMWE6NUMyMDdlMUFlZWU1NDkxODg2QjRjNDZjYTNlODViZEI=",
"Content-Type": "application/json"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
        200,
          204,
          201,
          202,
          203,
          205
        ]
      },
   "unsuccessResponses":
      {
        "statusCode":
        [
          400,
          404
        ]
      }
      
    }
]
}

pborah
Regular Contributor
Regular Contributor

Hi,

By misttake I have shared the wron file otherwise the JSON I am using is below. I am getting values out of that except imdlcreationdate, imdldeletiondate, legalHoldFlag, lineManagerFlag

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": true,
"url": "https://test.test/applications/${endpoints?.endpointname}/accounts",
"httpMethod": "POST",
"httpParams": "{\"status\":\"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}\",\"firstName\":\"${user?.firstname}\",\"lastName\":\"${user?.lastname}\",\"department\":\"${user.job_function}\",\"location\":\"${user.location}\",\"jobCode\":\"${user.jobCode}\",\"businessPhone\":\"${user.secondaryPhone}\",\"division\":\"${user.entity}\",\"addressLine2\":\"${user.locationdesc}\",\"title\":\"${user.title}\",\"addressLine1\":\"${user.locationdesc}\",\"city\":\"${user.city}\",\"displayName\":\"${user.displayname}\",\"accountSubType\":\"${user.employeeType}\",\"accountType\":\"${user.customproperty55}\",\"azureCorporateADAccountName\":\"${user.customproperty49}\",\"azureIQOSAccountId\":\"${user.customproperty50}\",\"azureIQOSAccountName\":\"${user.customproperty50}\",\"companyCode\":\"${user.companyname}\",\"companyCodeName\":\"${user.entity}\",\"costCenterName\":\"${user.costcenter}\",\"countryISOCode\":\"${user.country}\",\"departmentId\":\"${user.departmentNumber}\",\"departmentName\":\"${user.departmentname}\",\"deputy\":\"${user.doNotDisturbDelegate}\",\"domainAccount\":\"${user.customproperty60}\",\"emailAddress\":\"${user.customproperty61+'@pmintl.dev'}\",\"email\":\"${user.customproperty61+'@pmintl.dev'}\",\"employeeClass\":\"${user.employeeclass}\",\"employeeId\":\"${user.employeeid}\",\"endDate\":\"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"functionId\":\"${user.customproperty12}\",\"functionName\":\"${user.jobcodedesc}\",\"imdlCreationDate\":null,\"imdlDeletionDate\":null,\"initials\":\"${user.customproperty7}\",\"jobName\":\"${user.entity}\",\"locationNumber\":\"${user.locationnumber}\",\"mainIMDLAccount\":\"${user.customproperty4}\",\"manager\":\"${user.manager}\",\"mobileNumber\":\"${user.phonenumber}\",\"orgUnitId\":\"${user.orgunitid}\",\"orgUnitName\":\"${user.customproperty16}\",\"organization\":\"${user.customproperty3}\",\"organizationName\":\"${user.customproperty21}\",\"positionId\":\"${user.customproperty11}\",\"positionName\":\"${user.title}\",\"postalCode\":\"${user.regioncode}\",\"preferredFirstName\":\"${user.preferedFirstName}\",\"region\":\"${user.region}\",\"startDate\":\"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"street\":\"${user.street}\",\"subFunctionId\":\"${user.customproperty13}\",\"subFunctionName\":\"${user.customproperty17}\",\"userId\":\"${user.customproperty49}\",\"username\":\"${user.customproperty61+'@pmintl.dev'}\",\"workNumber\":\"${user.secondaryPhone}\",\"localMiddleName\":\"${user.customproperty10}\",\"localFirstName\":\"${user.customproperty9}\",\"localLastName\":\"${user.customproperty8}\",\"middleName\":\"${user.middlename}\",\"legalHoldFlag\":false,\"lineManagerFlag\":false}",
"httpHeaders":
{
"client_id": "test",
"client_secret": "test",
"Authorization":"Basic OWYzOWI2NTc1N2I3NDk2NDlmMDQ1NGNmMmNmNzYwMWE6NUMyMDdlMUFlZWU1NDkxODg2QjRjNDZjYTNlODViZEI=",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
204,
201,
202,
203,
205
]
},
"unsuccessResponses":
{
"statusCode":
[
400,
404
]
}

}
]
}

 

Output of the JSON is as below:

httpParams - [status:active, firstName:FNAME PBPPPBBGEA, lastName:LNAME PBPPPBBGEA changed, department:Sales, location:Depot Kecskemet, jobCode:12016387, businessPhone:null, division:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., addressLine2:Depot Kecskemet, title:Sales Supervisor, addressLine1:Depot Kecskemet, city:Kecskemet, displayName:DISPLAYNAME, accountSubType:EMPL, accountType:USR, azureCorporateADAccountName:null, azureIQOSAccountId:FNAMEPBPPPBBGEA.LNAMEPBPPPBBGEA_PMINTL.DEV#EXT#@IQOSonlineQA.onmicrosoft.com, azureIQOSAccountName:FNAMEPBPPPBBGEA.LNAMEPBPPPBBGEA_PMINTL.DEV#EXT#@IQOSonlineQA.onmicrosoft.com, companyCode:1065, companyCodeName:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., costCenterName:1065415020, countryISOCode:HU, departmentId:60048582, departmentName:PMI Hungary - General Management, deputy:null, domainAccount:BMagyar, emailAddress:BMagyar@pmintl.dev, email:BMagyar@pmintl.dev, employeeClass:PEMP, employeeId:00000000, endDate:9998-12-31T00:00:00.000Z, functionId:12000015, functionName:null, imdlCreationDate:null, imdlDeletionDate:null, initials:PBPPPBBGEA, jobName:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., locationNumber:0000001788, mainIMDLAccount:0000000000, manager:742896, mobileNumber:null, orgUnitId:40157666, orgUnitName:Regional Sales South-East 5, organization:1065, organizationName:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., positionId:60352696, positionName:Sales Supervisor, postalCode:6000, preferredFirstName:PBPPPBBGEA, region:null, startDate:2002-10-01T00:00:00.000Z, street:Bekescsabai út 2., subFunctionId:20855007, subFunctionName:Sales & Distribution, userId:null, username:BMagyar@pmintl.dev, workNumber:null, localMiddleName:MNAME PBPPPBBGEA, localFirstName:FNAME PBPPPBBGEA, localLastName:LNAME PBPPPBBGEACHANGED, middleName:MNAME PBPPPBBGEA, legalHoldFlag:false, lineManagerFlag:false]

khalidakhter
Saviynt Employee
Saviynt Employee

Hi,

There was an issue with JSON itself where you have defined endDate without any value where JSON always expects key-value pair in a map even if there is no value it must get populated as an empty string ("").
Please find the updated JSON and let me know if it works.

pborah
Regular Contributor
Regular Contributor

Hi,

By misttake I have shared the wron file otherwise the JSON I am using is below. I am getting values out of that except imdlcreationdate, imdldeletiondate, legalHoldFlag, lineManagerFlag

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": true,
"url": "https://test.test/applications/${endpoints?.endpointname}/accounts",
"httpMethod": "POST",
"httpParams": "{\"status\":\"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}\",\"firstName\":\"${user?.firstname}\",\"lastName\":\"${user?.lastname}\",\"department\":\"${user.job_function}\",\"location\":\"${user.location}\",\"jobCode\":\"${user.jobCode}\",\"businessPhone\":\"${user.secondaryPhone}\",\"division\":\"${user.entity}\",\"addressLine2\":\"${user.locationdesc}\",\"title\":\"${user.title}\",\"addressLine1\":\"${user.locationdesc}\",\"city\":\"${user.city}\",\"displayName\":\"${user.displayname}\",\"accountSubType\":\"${user.employeeType}\",\"accountType\":\"${user.customproperty55}\",\"azureCorporateADAccountName\":\"${user.customproperty49}\",\"azureIQOSAccountId\":\"${user.customproperty50}\",\"azureIQOSAccountName\":\"${user.customproperty50}\",\"companyCode\":\"${user.companyname}\",\"companyCodeName\":\"${user.entity}\",\"costCenterName\":\"${user.costcenter}\",\"countryISOCode\":\"${user.country}\",\"departmentId\":\"${user.departmentNumber}\",\"departmentName\":\"${user.departmentname}\",\"deputy\":\"${user.doNotDisturbDelegate}\",\"domainAccount\":\"${user.customproperty60}\",\"emailAddress\":\"${user.customproperty61+'@pmintl.dev'}\",\"email\":\"${user.customproperty61+'@pmintl.dev'}\",\"employeeClass\":\"${user.employeeclass}\",\"employeeId\":\"${user.employeeid}\",\"endDate\":\"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"functionId\":\"${user.customproperty12}\",\"functionName\":\"${user.jobcodedesc}\",\"imdlCreationDate\":null,\"imdlDeletionDate\":null,\"initials\":\"${user.customproperty7}\",\"jobName\":\"${user.entity}\",\"locationNumber\":\"${user.locationnumber}\",\"mainIMDLAccount\":\"${user.customproperty4}\",\"manager\":\"${user.manager}\",\"mobileNumber\":\"${user.phonenumber}\",\"orgUnitId\":\"${user.orgunitid}\",\"orgUnitName\":\"${user.customproperty16}\",\"organization\":\"${user.customproperty3}\",\"organizationName\":\"${user.customproperty21}\",\"positionId\":\"${user.customproperty11}\",\"positionName\":\"${user.title}\",\"postalCode\":\"${user.regioncode}\",\"preferredFirstName\":\"${user.preferedFirstName}\",\"region\":\"${user.region}\",\"startDate\":\"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"street\":\"${user.street}\",\"subFunctionId\":\"${user.customproperty13}\",\"subFunctionName\":\"${user.customproperty17}\",\"userId\":\"${user.customproperty49}\",\"username\":\"${user.customproperty61+'@pmintl.dev'}\",\"workNumber\":\"${user.secondaryPhone}\",\"localMiddleName\":\"${user.customproperty10}\",\"localFirstName\":\"${user.customproperty9}\",\"localLastName\":\"${user.customproperty8}\",\"middleName\":\"${user.middlename}\",\"legalHoldFlag\":false,\"lineManagerFlag\":false}",
"httpHeaders":
{
"client_id": "test",
"client_secret": "test",
"Authorization":"Basic OWYzOWI2NTc1N2I3NDk2NDlmMDQ1NGNmMmNmNzYwMWE6NUMyMDdlMUFlZWU1NDkxODg2QjRjNDZjYTNlODViZEI=",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
204,
201,
202,
203,
205
]
},
"unsuccessResponses":
{
"statusCode":
[
400,
404
]
}

}
]
}

 

Output of the JSON is as below:

httpParams - [status:active, firstName:FNAME PBPPPBBGEA, lastName:LNAME PBPPPBBGEA changed, department:Sales, location:Depot Kecskemet, jobCode:12016387, businessPhone:null, division:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., addressLine2:Depot Kecskemet, title:Sales Supervisor, addressLine1:Depot Kecskemet, city:Kecskemet, displayName:DISPLAYNAME, accountSubType:EMPL, accountType:USR, azureCorporateADAccountName:null, azureIQOSAccountId:FNAMEPBPPPBBGEA.LNAMEPBPPPBBGEA_PMINTL.DEV#EXT#@IQOSonlineQA.onmicrosoft.com, azureIQOSAccountName:FNAMEPBPPPBBGEA.LNAMEPBPPPBBGEA_PMINTL.DEV#EXT#@IQOSonlineQA.onmicrosoft.com, companyCode:1065, companyCodeName:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., costCenterName:1065415020, countryISOCode:HU, departmentId:60048582, departmentName:PMI Hungary - General Management, deputy:null, domainAccount:BMagyar, emailAddress:BMagyar@pmintl.dev, email:BMagyar@pmintl.dev, employeeClass:PEMP, employeeId:00000000, endDate:9998-12-31T00:00:00.000Z, functionId:12000015, functionName:null, imdlCreationDate:null, imdlDeletionDate:null, initials:PBPPPBBGEA, jobName:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., locationNumber:0000001788, mainIMDLAccount:0000000000, manager:742896, mobileNumber:null, orgUnitId:40157666, orgUnitName:Regional Sales South-East 5, organization:1065, organizationName:PHILIP MORRIS HUNGARY CIGARETTE TRADING LTD., positionId:60352696, positionName:Sales Supervisor, postalCode:6000, preferredFirstName:PBPPPBBGEA, region:null, startDate:2002-10-01T00:00:00.000Z, street:Bekescsabai út 2., subFunctionId:20855007, subFunctionName:Sales & Distribution, userId:null, username:BMagyar@pmintl.dev, workNumber:null, localMiddleName:MNAME PBPPPBBGEA, localFirstName:FNAME PBPPPBBGEA, localLastName:LNAME PBPPPBBGEACHANGED, middleName:MNAME PBPPPBBGEA, legalHoldFlag:false, lineManagerFlag:false]

${user.customproperty5!='YES'? 'false' :'true'} is still sending a string value to the target.

pborah
Regular Contributor
Regular Contributor

Hi,

Using the JSON shared by you the boolean value issue is solved and script is sending boolean values now.

This is worked. Thank you.

\"legalHoldFlag\":${user.customproperty20!='YES'? 'false' :'true'},\"lineManagerFlag\":${user.customproperty5!='YES'? 'false' :'true'}

However for the dates imdlcreationdate and imdldeletiondate I got below error while using the value suggested by you:

Values used:

\"imdlCreationDate\":\"${if (user.customproperty58!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"imdlDeletionDate\":\"${if (user.customproperty56!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty56);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\"

 

Error

2023-06-08/13:39:35.794 [{}] [quartzScheduler_Worker-2] ERROR rest.RestProvisioningService - Exception in creating original http params:com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","firstName":"${user?.firstname}","lastName":"${user?.lastname}","department":"${user.job_function}","location":"${user.location}","jobCode":"${user.jobCode}","businessPhone":"${user.secondaryPhone}","division":"${user.entity}","addressLine2":"${user.locationdesc}","title":"${user.title}","addressLine1":"${user.locationdesc}","city":"${user.city}","displayName":"${user.displayname}","accountSubType":"${user.employeeType}","accountType":"${user.customproperty55}","azureCorporateADAccountName":"${user.customproperty49}","azureIQOSAccountId":"${user.customproperty50}","azureIQOSAccountName":"${user.customproperty50}","companyCode":"${user.companyname}","companyCodeName":"${user.entity}","costCenterName":"${user.costcenter}","countryISOCode":"${user.country}","departmentId":"${user.departmentNumber}","departmentName":"${user.departmentname}","deputy":"${user.doNotDisturbDelegate}","domainAccount":"${user.customproperty60}","emailAddress":"${user.customproperty61+'@pmintl.dev'}","email":"${user.customproperty61+'@pmintl.dev'}","employeeClass":"${user.employeeclass}","employeeId":"${user.employeeid}","endDate":"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","functionId":"${user.customproperty12}","functionName":"${user.jobcodedesc}","imdlCreationDate":"${if (user.customproperty58!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","imdlDeletionDate":"${if (user.customproperty56!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty56);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","initials":"${user.customproperty7}","jobName":"${user.entity}","locationNumber":"${user.locationnumber}","mainIMDLAccount":"${user.customproperty4}","manager":"${user.manager}","mobileNumber":"${user.phonenumber}","orgUnitId":"${user.orgunitid}","orgUnitName":"${user.customproperty16}","organization":"${user.customproperty3}","organizationName":"${user.customproperty21}","positionId":"${user.customproperty11}","positionName":"${user.title}","postalCode":"${user.regioncode}","preferredFirstName":"${user.preferedFirstName}","region":"${user.region}","startDate":"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","street":"${user.street}","subFunctionId":"${user.customproperty13}","subFunctionName":"${user.customproperty17}","userId":"${user.customproperty49}","username":"${user.customproperty61+'@pmintl.dev'}","workNumber":"${user.secondaryPhone}","localMiddleName":"${user.customproperty10}","localFirstName":"${user.customproperty9}","localLastName":"${user.customproperty8}","middleName":"${user.middlename}","legalHoldFlag":${user.customproperty20!='YES'? 'false' :'true'},"lineManagerFlag":${user.customproperty5!='YES'? 'false' :'true'}}; line: 1, column: 1339]
2023-06-08/13:39:35.834 [{}] [quartzScheduler_Worker-2] DEBUG rest.RestProvisioningService - connection: acctAuth
2023-06-08/13:39:35.896 [{}] [quartzScheduler_Worker-2] ERROR rest.RestProvisioningService - Error in createNewUser::
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","firstName":"${user?.firstname}","lastName":"${user?.lastname}","depar

khalidakhter
Saviynt Employee
Saviynt Employee

Hi,

Date conversion will throw error because user's customproperty58 is of String data type and It seems difficult to convert a string to Date format inside the JSON.
I will recommend doing string conversion in such cases. Attaching a sample for that.

If you have a timestamp stored in the CP58 as 2023-06-08 14:59:10 then use the below string operation to get the Date as yyyy-MM-dd format.

\"imdlCreationDate\":\"${user.customproperty58!=null?user.customproperty58.split(' ')[0] :''}\"

You need to figure out a way to get the timestamp in the desired format.

pborah
Regular Contributor
Regular Contributor

Hi,

If I hardcode the value with required format  (ex: 2023-04-05T16:51:56+00:00) I do get 201 success response. Right now I have the task completed while using the above date format however no response from target. The only error I could see is below:

2023-06-08/13:39:35.794 [{}] [quartzScheduler_Worker-2] ERROR rest.RestProvisioningService - Exception in creating original http params:com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","firstName":"${user?.firstname}","lastName":"${user?.lastname}","department":"${user.job_function}","location":"${user.location}","jobCode":"${user.jobCode}","businessPhone":"${user.secondaryPhone}","division":"${user.entity}","addressLine2":"${user.locationdesc}","title":"${user.title}","addressLine1":"${user.locationdesc}","city":"${user.city}","displayName":"${user.displayname}","accountSubType":"${user.employeeType}","accountType":"${user.customproperty55}","azureCorporateADAccountName":"${user.customproperty49}","azureIQOSAccountId":"${user.customproperty50}","azureIQOSAccountName":"${user.customproperty50}","companyCode":"${user.companyname}","companyCodeName":"${user.entity}","costCenterName":"${user.costcenter}","countryISOCode":"${user.country}","departmentId":"${user.departmentNumber}","departmentName":"${user.departmentname}","deputy":"${user.doNotDisturbDelegate}","domainAccount":"${user.customproperty60}","emailAddress":"${user.customproperty61+'@pmintl.dev'}","email":"${user.customproperty61+'@pmintl.dev'}","employeeClass":"${user.employeeclass}","employeeId":"${user.employeeid}","endDate":"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","functionId":"${user.customproperty12}","functionName":"${user.jobcodedesc}","imdlCreationDate":"${if (user.customproperty58!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty58);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","imdlDeletionDate":"${if (user.customproperty56!=null) {Calendar today=Calendar.getInstance();today.setTime(user.customproperty56);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","initials":"${user.customproperty7}","jobName":"${user.entity}","locationNumber":"${user.locationnumber}","mainIMDLAccount":"${user.customproperty4}","manager":"${user.manager}","mobileNumber":"${user.phonenumber}","orgUnitId":"${user.orgunitid}","orgUnitName":"${user.customproperty16}","organization":"${user.customproperty3}","organizationName":"${user.customproperty21}","positionId":"${user.customproperty11}","positionName":"${user.title}","postalCode":"${user.regioncode}","preferredFirstName":"${user.preferedFirstName}","region":"${user.region}","startDate":"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","street":"${user.street}","subFunctionId":"${user.customproperty13}","subFunctionName":"${user.customproperty17}","userId":"${user.customproperty49}","username":"${user.customproperty61+'@pmintl.dev'}","workNumber":"${user.secondaryPhone}","localMiddleName":"${user.customproperty10}","localFirstName":"${user.customproperty9}","localLastName":"${user.customproperty8}","middleName":"${user.middlename}","legalHoldFlag":${user.customproperty20!='YES'? 'false' :'true'},"lineManagerFlag":${user.customproperty5!='YES'? 'false' :'true'}}; line: 1, column: 1339]

 

I will try to perform the above suggested steps and will let you know.

Regards,

Pallavi

pborah
Regular Contributor
Regular Contributor

Hi,

I got following error with above sript:

{"call1":{"headers":{"Strict-Transport-Security":"max-age=31536000; includeSubdomains;",TF-8"},"message":{"status":400,"message":"/imdlDeletionDate expected: null, found: String\n/imdlDeletionDate [] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]\n/imdlCreationDate expected: null, found: String\n/imdlCreationDate [2007-05-02] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]","type":"APIKIT","detail":"/imdlDeletionDate expected: null, found: String\n/imdlDeletionDate [] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]\n/imdlCreationDate expected: null, found: String\n/imdlCreationDate [2007-05-02] is not a valid date-time. Expected [yyyy-MM-dd'T'HH:mm:ssZ, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}Z, yyyy-MM-dd'T'HH:mm:ss[+-]HH:mm, yyyy-MM-dd'T'HH:mm:ss.[0-9]{1,9}[+-]HH:mm]","timestamp":"2023-06-09T11:29:29","id":"e5952510-06b8-11ee-9c46-06222881a5a1"},"statusCode":400,"description":null,"status":"Failed"}}
 
Regards,
Pallavi

pborah
Regular Contributor
Regular Contributor

Hi,

I was able to send the correct date value to target with some workaround as the above provided script did not work for me.

\"${user.customproperty58!=null? user.customproperty58+'T00:00:00Z' :null}\" is sending the required value and is success. But the issue happens if the value is null in saviynt side. As the target is expecting a boolean null and not sting "null" it gives error. I tried below:

${user.customproperty58!=null? user.customproperty58+'T00:00:00Z' :null}

But this does not work if the field has a date value and the taret want the date as string like 

"2023-05-25T16:36:29Z". So if I remove the quotes this does not work.
Is there any way to achieve this?
 
Regards,
Pallavi

khalidakhter
Saviynt Employee
Saviynt Employee

Hi @pborah 

You can try the below format for such use cases

\"imdlCreationDate\":${user.customproperty58!=null? '\"'+user.customproperty58.concat('T00:00:00Z')+'\"' :null},

.

pborah
Regular Contributor
Regular Contributor

Hi,

Yes I tried the same format on friday and this worked perfectly fine for me. Below is the working Create Account JSON with all Saviynt user attributes. Thank you for all your help and support.

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": true,
"url": "https://test/v2/applications/${endpoints?.endpointname}/accounts",
"httpMethod": "POST",
"httpParams": "{\"status\":\"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}\",\"firstName\":\"${user?.firstname}\",\"lastName\":\"${user?.lastname}\",\"department\":\"${user.job_function}\",\"location\":\"${user.location}\",\"jobCode\":\"${user.jobCode}\",\"businessPhone\":\"${user.secondaryPhone}\",\"division\":\"${user.entity}\",\"addressLine2\":\"${user.locationdesc}\",\"title\":\"${user.title}\",\"addressLine1\":\"${user.locationdesc}\",\"city\":\"${user.city}\",\"displayName\":\"${user.displayname}\",\"accountSubType\":\"${user.employeeType}\",\"accountType\":\"${user.customproperty55}\",\"azureCorporateADAccountName\":\"${user.customproperty49}\",\"azureIQOSAccountId\":\"${user.customproperty50}\",\"azureIQOSAccountName\":\"${user.customproperty50}\",\"companyCode\":\"${user.companyname}\",\"companyCodeName\":\"${user.entity}\",\"costCenterName\":\"${user.costcenter}\",\"countryISOCode\":\"${user.country}\",\"departmentId\":\"${user.departmentNumber}\",\"departmentName\":\"${user.departmentname}\",\"deputy\":\"${user.doNotDisturbDelegate}\",\"domainAccount\":\"${user.customproperty60}\",\"emailAddress\":\"${user.customproperty61+'@pmintl.dev'}\",\"email\":\"${user.customproperty61+'@pmintl.dev'}\",\"employeeClass\":\"${user.employeeclass}\",\"employeeId\":\"${user.employeeid}\",\"endDate\":\"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"functionId\":\"${user.customproperty12}\",\"functionName\":\"${user.jobcodedesc}\",\"imdlCreationDate\":${user.customproperty58!=null? '\"'+user.customproperty58+'T00:00:00Z\"' :null}, \"imdlDeletionDate\":${user.customproperty56!=null? '\"'+user.customproperty56+'T00:00:00Z\"' :null},\"initials\":\"${user.customproperty7}\",\"jobName\":\"${user.entity}\",\"locationNumber\":\"${user.locationnumber}\",\"mainIMDLAccount\":\"${user.customproperty4}\",\"manager\":\"${user.manager}\",\"mobileNumber\":\"${user.phonenumber}\",\"orgUnitId\":\"${user.orgunitid}\",\"orgUnitName\":\"${user.customproperty16}\",\"organization\":\"${user.customproperty3}\",\"organizationName\":\"${user.customproperty21}\",\"positionId\":\"${user.customproperty11}\",\"positionName\":\"${user.title}\",\"postalCode\":\"${user.regioncode}\",\"preferredFirstName\":\"${user.preferedFirstName}\",\"region\":\"${user.region}\",\"startDate\":\"${if (user.startdate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.startdate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\",\"street\":\"${user.street}\",\"subFunctionId\":\"${user.customproperty13}\",\"subFunctionName\":\"${user.customproperty17}\",\"userId\":\"${user.customproperty49}\",\"username\":\"${user.customproperty61+'@pmintl.dev'}\",\"workNumber\":\"${user.secondaryPhone}\",\"localMiddleName\":\"${user.customproperty10}\",\"localFirstName\":\"${user.customproperty9}\",\"localLastName\":\"${user.customproperty8}\",\"middleName\":\"${user.middlename}\",\"legalHoldFlag\":${user.customproperty20!='YES'? 'false' :'true'},\"lineManagerFlag\":${user.customproperty5!='YES'? 'false' :'true'}}",
"httpHeaders":
{
"client_id": "test",
"client_secret": "test",
"Authorization":"Basic 124jkdldnndtestdlMUFlZWU1NDkxODg2QjRjNDZjYTNlODViZEI=",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
204,
201,
202,
203,
205
]
},
"unsuccessResponses":
{
"statusCode":
[
400,
404
]
}

}
]
}

pborah
Regular Contributor
Regular Contributor

Hi @khalidakhter ,

The same format for startdate and endaDate which worked in Create Account is not working for enable/disable operation (PATCH call).

Format used: \"endDate\":\"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")} else {null}}\"

Error seen:

2023-06-12/10:41:24.189 [{}] [quartzScheduler_Worker-6] DEBUG rest.RestProvisioningService - connection: acctAuth
2023-06-12/10:41:24.311 [{}] [quartzScheduler_Worker-6] ERROR rest.RestProvisioningService - Error in processWebservicecom.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"mainIMDLAccount":"${user.customproperty4}","azureCorporateADAccountName":"${user.customproperty49}","azureIOQSAccountName":"${user.customproperty50}","azureIOQSAccountId":"${user.customproperty52}","domainAccount":"${user.customproperty60}","employeeId":"${user.employeeid}","endDate":"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","firstName":"${user.firstname}","lastName":"${user.lastname}","status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","initials":"${user.customproperty7}","isActive":true,"groupId":"${entitlementValue.id}","groupName":"${entitlementValue.entitlement_value}"}; line: 1, column: 407]
2023-06-12/10:41:24.312 [{}] [quartzScheduler_Worker-6] DEBUG println.PrintlnToLogger - Println :: | Error com.fasterxml.jackson.core.JsonParseException: Unexpected character ('y' (code 121)): was expecting comma to separate Object entries
at [Source: {"mainIMDLAccount":"${user.customproperty4}","azureCorporateADAccountName":"${user.customproperty49}","azureIOQSAccountName":"${user.customproperty50}","azureIOQSAccountId":"${user.customproperty52}","domainAccount":"${user.customproperty60}","employeeId":"${user.employeeid}","endDate":"${if (user.enddate!=null) {Calendar today=Calendar.getInstance();today.setTime(user.enddate);today.getTime().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")} else {null}}","firstName":"${user.firstname}","lastName":"${user.lastname}","status":"${user.statuskey==null?'':user.statuskey==1?'active':user.statuskey==0?'inactive':''}","initials":"${user.customproperty7}","isActive":true,"groupId":"${entitlementValue.id}","groupName":"${entitlementValue.entitlement_value}"}; line: 1, column: 407]
2023-06-12/10:41:24.312 [{}] [quartzScheduler_Worker-6] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
2023-06-12/10:41:24.312 [{}] [quartzScheduler_Worker-6] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
2023-06-12/10:41:24.312 [{}] [quartzScheduler_Worker-6] DEBUG println.PrintlnToLogger - Println :: | Error  at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)
2023-06-12/10:41:24.312 [{}] [quartzScheduler_Worker-6] DEBUG println.PrintlnToLogger - Println :: | Error  at

 

Any suggestion?

Regards,

Pallavi

khalidakhter
Saviynt Employee
Saviynt Employee

@pborah 

As this has been going on for a while, I will advise starting a new thread and attach the JSON.

pborah
Regular Contributor
Regular Contributor

This is resolved. Thank you. The issue was with groupname.