Skip to main content
September 6, 2022
Question

Get latest version number of many appian object via code

  • September 6, 2022
  • 6 replies
  • 0 views

I want to get latest version number of 50+ appian objects. Is there a way to write some script to get there version number based on their names. Currently i had to open each objects manually and note its version number.

    6 replies

    September 7, 2022

    Hi, you can use the below code but it will be used for some component only which you have to check. I check it for Expression rules, Constants and for interfaces. It won't run for Process model, DT, DS.

    a!localVariables(
      local!items: getcontentobjectswithnumofversions(1, "all", false()),
      local!itemsToCheck: a!forEach(
        items: local!items,
        expression: {
          Name: keyval(fv!item, "Name", ": ", ",UUID"),
          version: keyval(
            fv!item,
            "Total versions",
            ": ",
            ",Created"
          )
        }
      ),
      index(
        local!itemsToCheck,
        wherecontains(
          "UAC_account",
          a!flatten(local!itemsToCheck.Name)
        ),
        {}
      )
    )

    September 7, 2022

    Thanks Deepak. this will save a lot of time os me.

    harshitb6843
    September 7, 2022

    Other commentor has provided you with the solution but why would you need the versions of the objects in the code? Versions are something that designers use to compare and restore any lost functionality but why would you need to write it as logic in your ER/Interface? 

    September 7, 2022

    At the time of moving objects from one enviorment to other. I need to keep record of versions that i am deploying.

    csteward
    September 7, 2022

    This sounds like some development standard implemented by the company, which I would challenge - would be interested to hear the business logic behind it.

    You can easily compare deployment timestamps to version timestamps if needed, and object versions do not persist between environments - so an object with version 50 in dev will match the same object with say, version 12 in production.  

    We considered manually logging versions early on, but abandoned it for many reasons, and I have not needed anything like this in 13 years.  Just my $.02!