Transform Error

Hi Team,

I am getting this error on my transform, I tried multiple times but getting this same error, however the transform seems to be super straight forward but I am getting this error.

Error Below

Can you please suggest what is wrong here?

You will get an error if there is no value found for $emergencyExitValue inside the velocity template. You need to wrap the accountAttribute transform with a firstValid and add a second value (say “none”) and use $emergencyExitValue != 'none' inside your if condition instead of $emergencyExitValue != null

Hi @LearningStar

@iamnithesh’s suggestion is bang on! I think this is what you need instead based on what he suggested:

{
    "name": "Lifecycle State - Emergency Exit",
    "type": "static",
    "attributes": {
        "emergencyExitValue": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "sourceName": "Duplicate Source - Testing",
                            "attributeName": "emergencyExitFlag"
                        },
                        "type": "accountAttribute"
                    },
                    "none"
                ],
                "ignoreErrors": true
            }
        },
        "value": "#if($emergencyExitValue == 'true')Emergency Exit#else null#end"
    },
    "internal": false
}

Hi Gagan,

I believe you are in good hands. Additional tip: In case you only want to return true or false if an account exist for the identity in dedicated source: -

#if($emergencyExitValue == 'none')#{elseif($emergencyExitValue == 'true')}true#{else}false#{end}
:slight_smile:
Thanks,
Amar

Hi @iamnithesh Thanks for looking into the problem I tried setting all the other records in my disconnected source to None, leaving only a few with true values. However, I’m still encountering the same error. I came across one of your posts where you suggested this approach, but unfortunately, it didn’t work in my case. not sure why :frowning:
Should I try the first Valid ?

Amar no its not like that we need to check the account flag for the source if it has true then we should have the value as true otherwise false

Try this transform suggested by @trettkowski

image
we have some progress atleast that error gone but we are getting null even if my emergencyExitFlag = true

any suggestions @iamnithesh @trettkowski

Do you want to share the transform that you are now using?

Hi All - I suggest that the second value for firstValid of “none” should be wrapped in a static transform, not just the raw value.

@j_place @phil_awlings @iamnithesh @trettkowski

{
  "name": "Lifecycle State - Emergency Exit",
  "type": "static",
  "attributes": {
    "emergencyExitValue": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "attributes": {
              "sourceName": "Duplicate Source - Testing",
              "attributeName": "emergencyExitFlag"
            },
            "type": "accountAttribute"
          },
          "none"
        ],
        "ignoreErrors": true
      }
    },
    "value": "#if($emergencyExitValue == 'true')Emergency Exit#else null#end"
  },
  "internal": false
}

Hi @LearningStar As above, you need to wrap the second firstValid value in a static transform.

I think it is already wrapped inside the static transform, can you please suggest the correct version, I tried this one but it is showing me null even if my emergency flag has value as true ( should I change it to some other yes or no) if it is considering that value into Boolean form.

The second value in the firstValid transform should itself be a static transform. It is my understanding you can’t just provide a value.

PS - I would also remove the ignoreErrors as well, that’s not going to help.

Like this @j_place

{
  "name": "Lifecycle State - Emergency Exit",
  "type": "static",
  "attributes": {
    "emergencyExitValue": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "attributes": {
              "sourceName": "Duplicate Source - Testing",
              "attributeName": "emergencyExitFlag"
            },
            "type": "accountAttribute"
          },
          {
            "attributes": {
              "value" :"none",
            },
            "type": "static"
          }
        ]
      }
    },
    "value": "#if($emergencyExitValue == 'true')Emergency Exit#else false#end"
  },
  "internal": false
}

Looks almost there. You’ve got an extra “,” after “none” which shouldnt be there

How exactly does emergencyExitFlag from the source work? Is it either true or will have no value? If so, you can reverse the logic in the value string from

to

"value": "#if($emergencyExitValue == 'none')false#{else}Emergency Exit#end"

Hello,

In the Transforms, you cannot perform “null“ value checks. Its better that you assign an Static Value such as “None“ or “No-Value“ inside the firstValid transform and then, then, use in your velocity template where you are writing the IF ELSE conditions.

Use below.

{
  "name": "Lifecycle State - Emergency Exit",
  "type": "static",
  "attributes": {
    "emergencyExitValue": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "attributes": {
              "sourceName": "Duplicate Source - Testing",
              "attributeName": "emergencyExitFlag"
            },
            "type": "accountAttribute"
          },
          {
            "attributes": {
              "value" :"none"
            },
            "type": "static"
          }
        ]
      }
    },
    "value": "#if($emergencyExitValue == 'true')Emergency Exit#{else}false#end"
  },
  "internal": false
}