on
01/08/2023
02:38 PM
- edited on
05/31/2023
07:54 AM
by
Dave
Accounts are not getting created in target application and we see the below error message
DEBUG println.PrintlnToLogger - Println :: | Error Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate Object entries
at [Source:
The error message observed is due to the way json is constructed.
The json constructed is as below and is using New keyword. The new keyword is blocked in the latest release due to security restrictions.
[{"firstName": "${user.firstname==null? '': user.firstname+' ('+user.username+')'}","surName": "${user.lastname==null? '': user.lastname}","uiLanguage": "en-US","countryCode": "${user.customproperty8==null? '': user.customproperty8}","telephone": "${user.phonenumber==null? '': user.phonenumber}","loginType": "2","loginAccount": "${user.username==null? '': user.username+'@alstomgroup.com'}","email": "${user.email==null? '': user.email}","validUntil": "2999-12-31","costCenterCode": "${user.costcenter==null? '': user.costcenter}","validFrom":"2022-12-22","title": "${user.title==null? '': user.title}","loginAllowed": true,"CompanyCode": "Alstom","externalCode": "${user.username==null? '': user.username}","groups":[]"lastUpdated": "${(new Date()).format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")}"}]
We can use ${Calendar.getInstance().getTime().format('yyyyMMddHHmmss')}Z function instead of ${(new Date()).format('yyyyMMddHHmmss')}
I was trying to do email writeback for Workday and it wasn't working for the same reason. I updated the JSON as below:
[{
"CONNECTION": "login",
"REQUESTXML": "${user.email != null && user.email != '' ? ('<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:bsvc=\"urn:com.workday/bsvc\"> <soapenv:Header> <wsse:Security soapenv:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"> <wsse:UsernameToken wsu:Id=\"UsernameToken-64DBF26FBA30D3CCB6146964280369918\"> <wsse:Username>'+USERNAME+'</wsse:Username> <wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">'+PASSWORD+'</wsse:Password> <wsse:Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">lLP+oysknDXxg0ZcnRTUXg==</wsse:Nonce> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body><bsvc:Maintain_Contact_Information_for_Person_Event_Request xmlns:wd=\"urn:com.workday/bsvc\" bsvc:Add_Only=\"true\" bsvc:version=\"v36.0\"> <bsvc:Business_Process_Parameters> <bsvc:Auto_Complete>true</bsvc:Auto_Complete> <bsvc:Run_Now>true</bsvc:Run_Now> </bsvc:Business_Process_Parameters> <bsvc:Maintain_Contact_Information_Data> <bsvc:Worker_Reference> <bsvc:ID bsvc:type=\"Employee_ID\">'+user?.employeeid+'</bsvc:ID> </bsvc:Worker_Reference> <bsvc:Effective_Date>'+Calendar.getInstance().getTime().format(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\")+'</bsvc:Effective_Date> <bsvc:Worker_Contact_Information_Data> <bsvc:Email_Address_Data bsvc:Delete=\"false\" bsvc:Do_Not_Replace_All=\"true\"> <bsvc:Email_Address>'+user?.email+'</bsvc:Email_Address> <bsvc:Usage_Data bsvc:Public=\"true\"> <bsvc:Type_Data bsvc:Primary=\"true\"> <bsvc:Type_Reference> <bsvc:ID bsvc:type=\"Communication_Usage_Type_ID\">WORK</bsvc:ID> </bsvc:Type_Reference> </bsvc:Type_Data> </bsvc:Usage_Data> </bsvc:Email_Address_Data> </bsvc:Worker_Contact_Information_Data> </bsvc:Maintain_Contact_Information_Data></bsvc:Maintain_Contact_Information_for_Person_Event_Request></soapenv:Body> </soapenv:Envelope>') : ''}"}]
and it worked for me.
Hello @sahil ,
We tried to use a similar syntax in the JSON to push the owner of Service Account for Active Directory. The syntax is :
"manager": "${def g=com.saviynt.ecm.identitywarehouse.domain.User_accounts.findAllWhere([userkey: ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.id.toString()}[0]]).collect{com.saviynt.ecm.identitywarehouse.domain.Accounts.findWhere([id:it.accountkey])}.findAll{it.endpointkey.id==3L&&(it.status.equalsIgnoreCase('Active')||it.status.equalsIgnoreCase('1'))};if(g!=null&&!g.isEmpty()){g[0].customproperty3}}"
It resulted in following error in the task :
"ecm-worker","2023-05-10T04:34:28.313+00:00","2023-05-10T04:34:27.465782935Z stdout F java.lang.Exception: Template contains string which are not allowed com.saviynt."
Can you please assist here.
Best Regards,
Varun