Transform is leaving leading and trailing spaces

I have written a transform that splits the job code and from the job title and place it in the job code identity attribute. It is leaving leading and trailing spaces and causing problems with one of my Roles that looks at job code

“name”: “PROD_Split_JobCode”,

"type": "static",

"attributes": {

    "employeeType": {

        "type": "accountAttribute",

        "attributes": {

            "sourceName": "ARHPROD-Passport Database",

            "attributeName": "User_Type"

        }

    },

    "jobCode": {

        "type": "accountAttribute",

        "attributes": {

            "sourceName": "ARHPROD-Passport Database",

            "attributeName": "Title"

        }

    },

    "value": "#if($jobCode) #set($jobCode = $jobCode.trim()) #set($jobCode = $jobCode.replaceAll(' ', '')) #set($dashIndex = $jobCode.indexOf(\\"-\\")) #if($dashIndex > 0) $jobCode.substring(0, $dashIndex).trim() #else $jobCode.trim() #end #else blank #end"

},

"internal": false
"value": "#if($jobCode)#set($jobCode = $jobCode.trim())#set($jobCode = $jobCode.replaceAll(' ', ''))#set($dashIndex = $jobCode.indexOf(\\"-\\"))#if($dashIndex > 0)$jobCode.substring(0, $dashIndex).trim()#{else}$jobCode.trim()#end#{else}blank#end"

try this

Getting syntax error

image

"value": "#if($jobCode)#set($jobCode = $jobCode.trim())#set($jobCode = $jobCode.replaceAll(' ', ''))#set($dashIndex = $jobCode.indexOf(\"-\"))#if($dashIndex > 0)$jobCode.substring(0, $dashIndex).trim()#{else}$jobCode.trim()#end#{else}blank#end"

Nithesh

Thank you, I modified the transform and that worked.

1 Like