Lower + accountAttribute combination in LifeCycleState transform

I would like to apply transofrm “lower” to the attribute value extracted from source, and then use this value in further calculation in the value expression.

I’m testing with minimal parameters, but for some reason the LCS calculation gives an error.
I must have made a syntax error somewhere, but for 4 hours I can’t figure out where. Could u guide me guys what I’m doing wrong?

Thank u

{
    "id": "ab3c3bdf-8a4b-46d6-bd8d-24be6a71b436",
    "name": "Determine UserLifeCycleState Dummy",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "currentStatus": {
            "type": "lower",
            "name": "Lower Transform",
            "attributes": {
                "input": {
                    "type": "accountAttribute",
                    "attributes": {
                        "sourceName": "STAT2_Current",
                        "attributeName": "SAP HCM Dummy Source"
                    }
                }
            }
        },
        "value": "if($currentStatus=='inactive')inactive#{else}active#end"
    },
    "internal": false
}

This line is not needed, try removing it

Also, you probably don’t need the whole ‘lower’ part/ Just set the value in $currentStatus to equal the LCS:

{
    "name": "Determine UserLifeCycleState Dummy",
    "type": "static",
    "attributes": {
        "value": "if($currentStatus=='inactive')inactive#{else}active#end",
        "currentStatus": {
            "type": "accountAttribute",
            "attributes": {
                "sourceName": "STAT2_Current",
                "attributeName": "SAP HCM Dummy Source"
            }
        }
    }
}
1 Like

Pardon for wrong task explanation:
I have an “Active/Inactive” attribute value coming in the STAT2_Current (it’s a flag), so I wanted to apply lower after the value extraction process to avoid case sensitivity.

I hope I’ve managed to clear this up.

Then try this:

{
    "name": "Determine UserLifeCycleState Dummy",
    "type": "static",
    "attributes": {
        "value": "if($currentStatus=='inactive')inactive#{else}active#end",
        "currentStatus": {
            "type": "lower",
            "attributes": {
                "input": {
                    "type": "accountAttribute",
                    "attributes": {
                        "sourceName": "STAT2_Current",
                        "attributeName": "SAP HCM Dummy Source"
                    }
                }
            }
        }
    }
}

Though if the attributeName is blank, it will fail, so you need to wrap it in a firstValid

I’ve written the same code previously, doesn’t work out (for mock data I’ve always have STAT2_Current filled out.

{
    "id": "ab3c3bdf-8a4b-46d6-bd8d-24be6a71b436",
    "name": "Determine UserLifeCycleState Dummy",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "currentStatus": {
            "type": "firstValid",
            "attributes": {
                "ignoreErrors": "true",
                "values": [
                    {
                        "type": "lower",
                        "attributes": {
                            "input": {
                                "type": "accountAttribute",
                                "attributes": {
                                    "sourceName": "STAT2_Current",
                                    "attributeName": "SAP HCM Dummy Source"
                                }
                            }
                        }
                    },
                    "active"
                ]
            }
        },
        "value": "if($currentStatus=='inactive')inactive#{else}active#end"
    },
    "internal": false
}

Although I found a typo in sourceName and attributeName, (I’ve mixed them up). It didn’t resolve the issue.

{
    "id": "ab3c3bdf-8a4b-46d6-bd8d-24be6a71b436",
    "name": "Determine UserLifeCycleState Dummy",
    "type": "static",
    "attributes": {
        "requiresPeriodicRefresh": "true",
        "currentStatus": {
            "type": "firstValid",
            "attributes": {
                "ignoreErrors": "true",
                "values": [
                    {
                        "type": "lower",
                        "attributes": {
                            "input": {
                                "type": "accountAttribute",
                                "attributes": {
                                    "attributeName": "STAT2_Current",
                                    "sourceName": "SAP HCM Dummy Source"
                                }
                            }
                        }
                    },
                    "active"
                ]
            }
        },
        "value": "if($currentStatus=='inactive')inactive#{else}active#end"
    },
    "internal": false
}

FirstValid is in the wrong place, it needs to go around the attribute you are pulling in:

{
  "name": "Determine UserLifeCycleState Dummy",
  "type": "static",
  "attributes": {
    "value": "if($currentStatus=='inactive')inactive#{else}active#end",
    "currentStatus": {
      "type": "lower",
      "attributes": {
        "input": {
          "type": "firstValid",
          "attributes": {
            "values": [
              {
                "type": "accountAttribute",
                "attributes": {
                  "sourceName": "SAP HCM Dummy Sourcet",
                  "attributeName": "STAT2_Current"
                }
              },
              "XXX1"
            ],
            "ignoreErrors": false
          }
        }
      }
    }
  }
}
1 Like

Thank u Phil,
This worked out, really appreciated.

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.