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

Error in update account json

Abdul_Gaffar
New Contributor II
New Contributor II

Hi ,

We are trying to configure update account json with a null check as follows ,

However , when we trigger a task following is the error message

{ if(nul ^ 1 error Error while Update operation for account-ltestdev in AD - Template contains string which are not allowed \bnew\s+[a-zA-Z0-9_.]{1,}\s*\(

 

JSON:

${Map map1 = new HashMap();
{
if(null!=user.customproperty32)map1.put('co', user.customproperty32);
if(null!=user.country)map1.put('c', user.country);
if(null!=user.title)map1.put('title', user.title);
if(null!=user.state)map1.put('st', user.state);
if(null!=user.customproperty16)map1.put('division', user.customproperty16);
if(null!=user.locationdesc)map1.put('physicalDeliveryOfficeName', user.locationdesc);
if(null!=user.street)map1.put('streetAddress', user.street);
if(null!=user.departmentname)map1.put('department', user.departmentname);
if(null!=user.customproperty33)map1.put('countryCode', user.customproperty33);
if(null!=user.customproperty17)map1.put('company', user.customproperty17);
if(null!=user.locationnumber)map1.put('extensionAttribute13', user.locationnumber);
if(null!=user.customproperty27)map1.put('extensionAttribute14', user.customproperty27);
if(null!=user.customproperty27)map1.put('extensionAttribute8', user.customproperty27);
if(null!=user.employeeid)map1.put('extensionAttribute1', user.employeeid);
if(null!=user.manager)map1.put('manager', user.manager);
if(null!=user.employeeid)map1.put('employeeID', user.employeeid);
if(null!=user.manager)map1.put('manager', managerAccount?.comments);
if(null!=user.phonenumber)map1.put('telephoneNumber', user.phonenumber);
if(null!=user.customproperty12)map1.put('extensionAttribute6', user.customproperty12);
if(null!=user.city)map1.put('l', user.city);
if(null!=user.customproperty13)map1.put('postalCode', user.customproperty13);
if(user.leaveStatus.equals('LEAVE')) {
map1.put('extensionAttribute4', 'exclude');
map1.put('extensionAttribute11', 'exclude');
}
else {
map1.put('extensionAttribute4', '');
map1.put('extensionAttribute11', '');
}
if(user.employeeType.equals('Employee')) {
map1.put('msExchExtensionAttribute23', 'Employee');
}
else {
map1.put('msExchExtensionAttribute23', 'External Worker');
}
if(user.country.equals('US')) {
map1.put('msExchExtensionAttribute24', 'US');
}
else {
map1.put('msExchExtensionAttribute24', 'INTL');
}

}
jsonBuilder = new groovy.json.JsonBuilder(map1);
return jsonBuilder.toString();
}

please suggest what remediations can be done for this 

Thanks & regards

Abdul Gaffar

2 REPLIES 2

CR
Regular Contributor III
Regular Contributor III

@Abdul_Gaffar  Can you try below :

just i changed single to quote to double quote for java code

 

${Map map1 = new HashMap();
{
if(null!=user.customproperty32)map1.put("co", user.customproperty32);
if(null!=user.country)map1.put("c", user.country);
if(null!=user.title)map1.put("title", user.title);
if(null!=user.state)map1.put("st", user.state);
if(null!=user.customproperty16)map1.put("division", user.customproperty16);
if(null!=user.locationdesc)map1.put("physicalDeliveryOfficeName", user.locationdesc);
if(null!=user.street)map1.put("streetAddress", user.street);
if(null!=user.departmentname)map1.put("department", user.departmentname);
if(null!=user.customproperty33)map1.put("countryCode", user.customproperty33);
if(null!=user.customproperty17)map1.put("company", user.customproperty17);
if(null!=user.locationnumber)map1.put("extensionAttribute13", user.locationnumber);
if(null!=user.customproperty27)map1.put("extensionAttribute14", user.customproperty27);
if(null!=user.customproperty27)map1.put("extensionAttribute8", user.customproperty27);
if(null!=user.employeeid)map1.put("extensionAttribute1", user.employeeid);
if(null!=user.manager)map1.put("manager", user.manager);
if(null!=user.employeeid)map1.put("employeeID", user.employeeid);
if(null!=user.manager)map1.put("manager", managerAccount?.comments);
if(null!=user.phonenumber)map1.put("telephoneNumber", user.phonenumber);
if(null!=user.customproperty12)map1.put("extensionAttribute6", user.customproperty12);
if(null!=user.city)map1.put("l", user.city);
if(null!=user.customproperty13)map1.put("postalCode", user.customproperty13);
if(user.leaveStatus.equals("LEAVE")) {
map1.put("extensionAttribute4", "exclude");
map1.put("extensionAttribute11", "exclude");
}
else {
map1.put("extensionAttribute4", "");
map1.put("extensionAttribute11", "");
}
if(user.employeeType.equals("Employee")) {
map1.put("msExchExtensionAttribute23", "Employee");
}
else {
map1.put("msExchExtensionAttribute23", "External Worker");
}
if(user.country.equals("US")) {
map1.put("msExchExtensionAttribute24", "US");
}
else {
map1.put("msExchExtensionAttribute24", "INTL");
}

}
jsonBuilder = new groovy.json.JsonBuilder(map1);
return jsonBuilder.toString();
}


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

Abdul_Gaffar
New Contributor II
New Contributor II

Hi @CR 

I did the change as you specified above , However the error still persists

Thanks

Abdul Gaffar