and more in a single search tool across platforms. Read the announcement here. |
01/17/2024 02:38 PM
How can brackets be removed from Service Account Owner attribute values when provisioning to AD?
Example:
{
"info": "Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('26').collect{it.customproperty3.toString()}}",
"sn": "${ServiceAccountOwnerMap.get('USEROWNERS').get('26').collect{it.lastname.toString()}}",
"givenName": "${ServiceAccountOwnerMap.get('USEROWNERS').get('26').collect{it.firstname.toString()}}"
}
Values sent to AD look like following:
Owner - [custprop3value]
[lastnamevalue]
[firstnamevalue]
I have tried the following:
"Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.custom property3.toString().replace("[", "").replace("]", "")}}",
"Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.custom property3.toString().replace(\"[\", \"\").replace(\"]\", \"\")}}",
"Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.custom property3.toString().replace(\\\"[\\\", \\\"\\\").replace(\\\"]\\\", \\\"\\\")}}",
These result in error: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript14.groovy: 14: unexpected char: '\'
I have also tried single quotes around the bracket but that does not do anything and value still ends with brackets around it.
"Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.customproperty3.toString().replace('[', '').replace(']', '')}}",
Solved! Go to Solution.
01/17/2024 03:15 PM
Sample
${entitlement_values.collect{it.toString().indexOf("(") == -1 ? it : it.toString().substring(0, it.toString().indexOf("(") -1)}.toListString().replaceAll('\\[|\\]','')}
01/18/2024 07:32 AM
The following still does not strip the brackets:
"info": "Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.customproperty3.toString().replaceAll('\\[|\\]','')}}",
01/18/2024 07:39 PM
"info": "Owner - ${ServiceAccountOwnerMap.get('USEROWNERS').get('1').collect{it.customproperty3}.toString().replaceAll('\\[|\\]','')}",