BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

Javascript initialization: Distinguish between business objects with the same name?

  • 1.  Javascript initialization: Distinguish between business objects with the same name?

    Posted Tue December 14, 2021 04:00 PM
    It was a while since last time, but I once again tripped when trying to initialize a complex object whose name exists in both the application and at least one toolkit.

    When I write new tw.object.MyObject() in the service flow script, I get more than one code assist suggestion, but the tooltip does not tell me which is which. In this particular situation, there are three definitions (two from two toolkits). I know I can write tw.object.toolkit.ACRONYM.MyObject() to pick one from a particular toolkit, but I want the one from the application I am currently in and I can't see such an option. Is there a dependable order, such as first application definition and then toolkit definitions (in acronym order)? Or some method under tw.object that I don't yet know?

    I would rather not have to test my way through this. Note that the application definition and one toolkit definition have the exactly same structure, so I can't  initalize it and then use code assist to inspect the subobjects until I find a difference.

    ------------------------------
    Mattias Edling
    ------------------------------


  • 2.  RE: Javascript initialization: Distinguish between business objects with the same name?

    Posted Wed January 05, 2022 03:58 PM
    It does not matter which tw.object.MyObject() is picked.  The runtime result will be the same, since the script is the same. Without using .toolkit namespace to disambiguate project, the object in current project should take precedence at runtime.

    ------------------------------
    Konrad Kolosowski
    ------------------------------