trackingId: 25e83d5b93154e8395c3c99a3dc58468 com.sailpoint.seaspray.template.TemplateException: Error rendering template: #if($branchCode == '')00000#{else}$branchCode#end

Hi Team,
I have a transform that to set static value for a attribute “brachcode”
The problem is that when I try , it doesn’t work.Here’s the transform:

{

   "attributes":{

      "branchCode":{

         "attributes":{

            "values":[

               {

                  "attributes":{

                     "attributeName":"branchCode",

                     "sourceName":"TestSF"

                  },

                  "type":"accountAttribute"

               },

            ]

         },

         "type":"firstValid"

      },

      "value": "#if($branchCode == '')00000#{else}$branchCode#end"

   },

   "name": "BranchCode",

   "type":"static"

}

The error is:
trackingId: 25e83d5b93154e8395c3c99a3dc58468 com.sailpoint.seaspray.template.TemplateException: Error rendering template: #if($branchCode == ‘’)00000#{else}$branchCode#end

Any thoughts would be great.

Hi @kumarikrity,

Please try the below transform

{
“attributes”:{
“values”:[
{
“attributes”:{
“attributeName”:“branchCode”,
“sourceName”:“TestSF”
},
“type”:“accountAttribute”
},
{
“attributes”:{
“value”:“0000”
},
“type”:“static”
}
]
},
“type”:“firstValid”,
“name”:“BranchCode”
}

Thanks,
Sushant

@ Sushant Maharjan Thank You! but i have to implement below condition as well:
if($Person.Branch -ne “”){
$Branch = $Person.Branch
}
else {$Branch = “00000” }

Hi @kumarikrity,

It looks like you want to return the static value if you are not getting any value on the “branchCode” attribute from the TestSF source. If that’s your goal, then the above firstValid transform should do the job. But, if you want to introduce if-else logic, then please use the below transform

{
“attributes”:{
“branchCode”:{
“attributes”:{
“values”:[
{
“attributes”:{
“attributeName”:“branchCode”,
“sourceName”:“TestSF”
},
“type”:“accountAttribute”
},
“noValueOnBranchCode”
]
},
“type”:“firstValid”
},
“value”:“#if($branchCode == ‘noValueOnBranchCode’)00000#{else}$branchCode#end”
},
“name”:“BranchCode”,
“type”:“static”
}

@Sushantmrj Its working now. Thank You!