Can anyone help me to write transform in provisioning policy to set max length limit upto 8 character as firstname?
Hi @asriva14,
You can refer this post to do this:
2 Likes
Hi @asriva14 ,
{
"name": "Test Transform",
"type": "substring",
"attributes": {
"begin": 0,
"end": 8,
"input": {
"type": "identityAttribute",
"attributes": {
"name": "firstname"
}
}
}
}
Try using the above template. Thanks!!
Hi @asriva14 ,
This should work :
{
"name": "firstName",
"transform": {
"type": "static",
"attributes": {
"fName": {
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"name": "firstName"
},
"type": "identityAttribute"
},
"none"
]
}
},
"value": "#if($fName == 'none')#else$fName.substring(0,7)#end"
}
},
"attributes": {},
"isRequired": false,
"type": "string",
"isMultiValued": false
}
3 Likes
This is the best route.
The substring
primitive will error if the input is fewer than the specified number of characters, but doing it with Velocity in a static
transform works around that limitation.
just made few changes and it worked-
“value”: “#set($length = 8)#if($fName.length() > $length)$fName.substring(0,$length)#{else}$fName#end”
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.