Imperative Extensions

Imperative extensions enable you to create reusable utility code to address complex use cases that aren't supported in UTAM's JSON grammar. For example, you can't use the JSON grammar to navigate a data table where each column shows data from a different type of component with different markup.

Note: Imperative extensions are powerful because you can use the full capabilities of a programming language. However, we strongly discourage their usage except as a last resort because they violate the declarative nature of UTAM. If you use an imperative extension, you must implement and maintain it in each programming language that you use with UTAM.

Declare imperative utility code in a compose statement. A page object can reference multiple utilities.

{
    "methods": [
        {
            "name": "myMethod",
            "compose": [
                {
                    "applyExternal": {
                        "type": "utam-lst/utils/lst/relatedListContainerUtils",
                        "invoke": "cardUtility1",
                        "args": [
                            {
                                "name": "stringArg",
                                "type": "string"
                            }
                        ]
                    }
                },
                {
                    "applyExternal": {
                        "type": "utam-lst/utils/lst/relatedListContainerUtils",
                        "invoke": "cardUtility2",
                        "args": [
                            {
                                "name": "booleanArg",
                                "type": "boolean"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

An imperative extension in a compose statement has these properties:

For examples of Java and JavaScript code implementations, see Guide: Imperative Extensions.