Transform a display name

I am really struggling to get one of my transforms to work. We have several users in our HR Source. I want to populate the users “Display Name” via a transform.

Where we concat the “First Name”, “Last Name” and then where the user has specific values existing in 1 of 2 possible attributes concat the contents of another attribute.

This is the code I am trying to use, but SailPoint throws a processing error when trying to process the identity…

{

  "id": "IDNUMBER",

  "name": "SYP - Calculate Display Name",

  "type": "concat",

  "attributes": {

    "values": [

      {

        "attributes": {

          "values": [

            {

              "attributes": {

                "attributeName": "KNOWN_AS",

                "sourceName": "SYP - HR"

              },

              "type": "accountAttribute"

            },

            {

              "attributes": {

                "attributeName": "FIRST_NAME",

                "sourceName": "SYP - HR"

              },

              "type": "accountAttribute"

            }

          ]

        },

        "type": "firstValid"

      },

      " ",

      {

        "attributes": {

          "attributeName": "LAST_NAME",

          "sourceName": "SYP - HR"

        },

        "type": "accountAttribute"

      },




      {

        "type": "conditional",

        "attributes": {

          "expression": "$payrollUpper eq P",

          "positiveCondition": "$collarPiece",

          "negativeCondition": "",




          "payrollUpper": {

            "type": "upper",

            "attributes": {

              "value": {

                "type": "firstValid",

                "attributes": {

                  "values": [

                    {

                      "type": "trim",

                      "attributes": {

                        "value": {

                          "type": "accountAttribute",

                          "attributes": {

                            "attributeName": "PAYROLL_NAME",

                            "sourceName": "SYP - HR"

                          }

                        }

                      }

                    },

                    { "type": "static", "attributes": { "value": "" } }

                  ]

                }

              }

            }

          },




          "collarTrim": {

            "type": "firstValid",

            "attributes": {

              "values": [

                {

                  "type": "trim",

                  "attributes": {

                    "value": {

                      "type": "accountAttribute",

                      "attributes": {

                        "attributeName": "COLLAR_NO",

                        "sourceName": "SYP - HR"

                      }

                    }

                  }

                },

                { "type": "static", "attributes": { "value": "" } }

              ]

            }

          },




          "empty": { "type": "static", "attributes": { "value": "" } },




          "collarPiece": {

            "type": "conditional",

            "attributes": {

              "expression": "$collarTrim eq $empty",

              "positiveCondition": "",

              "negativeCondition": {

                "type": "concat",

                "attributes": {

                  "values": [

                    " ",

                    { "type": "static", "attributes": { "value": "$collarTrim" } }

                  ]

                }

              }

            }

          }

        }

      }

    ]

  },

  "internal": false

Hi @george-biggin,

Can you share the error that you are facing ?

@george-biggin I noticed the Upper transform syntax you’re using is incorrect (missin input key, and using value key). Please refer to the documentation for the correct syntax.

Hi. Thanks for the super quick response

sailpoint.api.AttributePromotionException: Applying transform[reference] to attribute[displayName] failed

Hi,

Try to use this way:

{
"id": "IDNUMBER",
“name”: “SYP - Calculate Display Name”,
“type”: “concat”,
“attributes”: {
“values”: [
{
“type”: “firstValid”,
“attributes”: {
“values”: [
{
“type”: “accountAttribute”,
“attributes”: {
“attributeName”: “KNOWN_AS”,
“sourceName”: “SYP - HR”
}
},
{
“type”: “accountAttribute”,
“attributes”: {
“attributeName”: “FIRST_NAME”,
“sourceName”: “SYP - HR”
}
}
]
}
},
" ",
{
“type”: “accountAttribute”,
“attributes”: {
“attributeName”: “LAST_NAME”,
“sourceName”: “SYP - HR”
}
},
{
“type”: “conditional”,
“attributes”: {
“expression”: “$payrollUpper eq ‘P’”,
“positiveCondition”: {
“type”: “concat”,
“attributes”: {
“values”: [
" ",
{
“type”: “firstValid”,
“attributes”: {
“values”: [
{
“type”: “trim”,
“attributes”: {
“value”: {
“type”: “accountAttribute”,
“attributes”: {
“attributeName”: “COLLAR_NO”,
“sourceName”: “SYP - HR”
}
}
}
},
“”
]
}
}
]
}
},
“negativeCondition”: “”,
“payrollUpper”: {
“type”: “upper”,
“attributes”: {
“value”: {
“type”: “trim”,
“attributes”: {
“value”: {
“type”: “accountAttribute”,
“attributes”: {
“attributeName”: “PAYROLL_NAME”,
“sourceName”: “SYP - HR”
}
}
}
}
}
}
}
}
]
}
}

Hi Lydia,

I had to switch out the Quotes for straight quotes which allowed me to update my Sandbox transform, but it still comes up with the same processing error I’m afraid.

Just having a look through the documentation.

Peter,

Have you also tried adding single quotes in your transform, like (… eq ‘P’)?

1 Like

@george-biggin Can you try if this works?

  1. removed quotes: "expression": "$payrollUpper eq P" (you can try with single ‘ also afterwards)

  2. added “input“ for “upper“ transform

  3. referenced $collarTrim directly in array below

  4. referenced $collarConcat as negativeCondition before defining it.

{
  "id": "IDNUMBER",
  "name": "SYP - Calculate Display Name",
  "type": "concat",
  "attributes": {
    "values": [
      {
        "attributes": {
          "values": [
            {
              "attributes": {
                "attributeName": "KNOWN_AS",
                "sourceName": "SYP - HR"
              },
              "type": "accountAttribute"
            },
            {
              "attributes": {
                "attributeName": "FIRST_NAME",
                "sourceName": "SYP - HR"
              },
              "type": "accountAttribute"
            }
          ]
        },
        "type": "firstValid"
      },
      " ",
      {
        "attributes": {
          "attributeName": "LAST_NAME",
          "sourceName": "SYP - HR"
        },
        "type": "accountAttribute"
      },
      {
        "type": "conditional",
        "attributes": {
          "expression": "$payrollUpper eq P",
          "positiveCondition": "$collarPiece",
          "negativeCondition": "",
          "payrollUpper": {
            "type": "upper",
            "attributes": {
              "input": {
                "type": "firstValid",
                "attributes": {
                  "values": [
                    {
                      "type": "trim",
                      "attributes": {
                        "input": {
                          "type": "accountAttribute",
                          "attributes": {
                            "attributeName": "PAYROLL_NAME",
                            "sourceName": "SYP - HR"
                          }
                        }
                      }
                    },
                    {
                      "type": "static",
                      "attributes": {
                        "value": ""
                      }
                    }
                  ]
                }
              }
            }
          },
          "collarTrim": {
            "type": "firstValid",
            "attributes": {
              "values": [
                {
                  "type": "trim",
                  "attributes": {
                    "input": {
                      "type": "accountAttribute",
                      "attributes": {
                        "attributeName": "COLLAR_NO",
                        "sourceName": "SYP - HR"
                      }
                    }
                  }
                },
                {
                  "type": "static",
                  "attributes": {
                    "value": ""
                  }
                }
              ]
            }
          },
          "empty": {
            "type": "static",
            "attributes": {
              "value": ""
            }
          },
          "collarPiece": {
            "type": "conditional",
            "attributes": {
              "expression": "$collarTrim eq $empty",
              "positiveCondition": "",
              "negativeCondition": "$collarConcat",
              "collarConcat": {
                "type": "concat",
                "attributes": {
                  "values": [
                    " ",
                    "$collarTrim"
                  ]
                }
              }
            }
          }
        }
      }
    ]
  },
  "internal": false
}
1 Like

Incorrect syntax section.

      "expression": "$payrollUpper eq P",
1 Like

I really appreciate you taking the time to help with this.

I’ve tried this and also tried encapsulating the P in single quotes, but still appears to throw the same Processing error :frowning:

Hi @george-biggin,

Could you please share the error you’re encountering and where it appears? Is it occurring on the Identity Profile > Preview page, or when you check the identity directly?

Also, please check the Identity Profile > Preview page to see if a more detailed error message is available.

I see the error directly on an identity if I “Process Identity”. Unfortunately, in the Identity profile-Preview page I just get the error symbol with no further info.

The following simple concat transform works fine, where it’s just joining first name and last name.

{
    "id": "ID",
    "name": "SYP - Calculate Display Name",
    "type": "concat",
    "attributes": {
        "values": [
            {
                "attributes": {
                    "values": [
                        {
                            "attributes": {
                                "attributeName": "KNOWN_AS",
                                "sourceName": "SYP - HR"
                            },
                            "type": "accountAttribute"
                        },
                        {
                            "attributes": {
                                "attributeName": "FIRST_NAME",
                                "sourceName": "SYP - HR"
                            },
                            "type": "accountAttribute"
                        }
                    ]
                },
                "type": "firstValid"
            },
            " ",
            {
                "attributes": {
                    "attributeName": "LAST_NAME",
                    "sourceName": "SYP - HR"
                },
                "type": "accountAttribute"
            }
        ]
    },
    "internal": false
}

Just dug deeper and found this error.. Looks like it the collartrim it’s struggling to render

Error during transformation for attribute: displayName (Transform ID: SYP - Calculate Display Name) Cause: Error rendering template: $collarTrim

In the negative condition, I noticed that no value is being provided. Please add a dummy value there and perform your checks later based on that value. Not providing any value in the negativeCondition might be causing the issue.

Hi @george-biggin,

Can you try using below transform, there were lot of syntax mistakes in your version.

{
  "id": "IDNUMBER",
  "name": "SYP - Calculate Display Name",
  "type": "concat",
  "attributes": {
    "values": [
      {
        "attributes": {
          "values": [
            {
              "attributes": {
                "attributeName": "KNOWN_AS",
                "sourceName": "SYP - HR"
              },
              "type": "accountAttribute"
            },
            {
              "attributes": {
                "attributeName": "FIRST_NAME",
                "sourceName": "SYP - HR"
              },
              "type": "accountAttribute"
            }
          ]
        },
        "type": "firstValid"
      },
      " ",
      {
        "attributes": {
          "attributeName": "LAST_NAME",
          "sourceName": "SYP - HR"
        },
        "type": "accountAttribute"
      },
      {
        "type": "static",
        "attributes": {
          "payrollUpper": {
            "type": "upper",
            "attributes": {
              "input": {
                "type": "firstValid",
                "attributes": {
                  "ignoreErrors": true,
                  "values": [
                    {
                      "type": "trim",
                      "attributes": {
                        "value": {
                          "type": "accountAttribute",
                          "attributes": {
                            "attributeName": "PAYROLL_NAME",
                            "sourceName": "SYP - HR"
                          }
                        }
                      }
                    },
                    "Empty"
                  ]
                }
              }
            }
          },
          "collarTrim": {
            "type": "firstValid",
            "attributes": {
              "ignoreErrors": true,
              "values": [
                {
                  "type": "trim",
                  "attributes": {
                    "value": {
                      "type": "accountAttribute",
                      "attributes": {
                        "attributeName": "COLLAR_NO",
                        "sourceName": "SYP - HR"
                      }
                    }
                  }
                },
                "Empty"
              ]
            }
          },
          "value": "#if( ($payrollUpper == 'P') && ($collarTrim != 'Empty'))$collarTrim#{else}#end"
        }
      }
    ]
  },
  "internal": false
}

Also, please verify if your existing logic/requirements are fulfilled.

2 Likes

Hi @george-biggin,

Have you had a chance to try the transforms mentioned above ?
Please let us know if you are still experiencing the same issue.

Your error Error rendering template: $collarTrim is happening because $collarTrim is being treated as a Velocity template variable somewhere (Static transform), but it’s not in scope for that Static transform unless you define it inside that Static transform’s attributes.

Also, you have a couple of common Transform syntax issues mixed in:
1- upper and trim should use attributes.input, not attributes.value
2- conditional requires BOTH positiveCondition and negativeCondition, and they’re strings (if you want to “return another transform,” define it as a variable in attributes and return it as “$varName”)

A pattern that avoids the $collarTrim rendering problem is: compute the “suffix” as a variable, then return it by reference:

{
  "name": "SYP - Calculate Display Name",
  "type": "concat",
  "attributes": {
    "values": [
      {
        "type": "firstValid",
        "attributes": {
          "values": [
            { "type": "accountAttribute", "attributes": { "sourceName": "SYP - HR", "attributeName": "KNOWN_AS" } },
            { "type": "accountAttribute", "attributes": { "sourceName": "SYP - HR", "attributeName": "FIRST_NAME" } },
            ""
          ]
        }
      },
      " ",
      { "type": "accountAttribute", "attributes": { "sourceName": "SYP - HR", "attributeName": "LAST_NAME" } },

      {
        "type": "conditional",
        "attributes": {
          "expression": "$payrollUpper eq P",
          "positiveCondition": "$suffix",
          "negativeCondition": "",

          "payrollUpper": {
            "type": "upper",
            "attributes": {
              "input": {
                "type": "firstValid",
                "attributes": {
                  "values": [
                    {
                      "type": "trim",
                      "attributes": {
                        "input": { "type": "accountAttribute", "attributes": { "sourceName": "SYP - HR", "attributeName": "PAYROLL_NAME" } }
                      }
                    },
                    ""
                  ]
                }
              }
            }
          },

          "suffix": {
            "type": "static",
            "attributes": {
              "value": "#if($collar != \"\") $space$collar #end",
              "space": " ",
              "collar": {
                "type": "firstValid",
                "attributes": {
                  "values": [
                    {
                      "type": "trim",
                      "attributes": {
                        "input": { "type": "accountAttribute", "attributes": { "sourceName": "SYP - HR", "attributeName": "COLLAR_NO" } }
                      }
                    },
                    ""
                  ]
                }
              }
            }
          }
        }
      }
    ]
  }
}
1 Like