Question
· Mar 18, 2021

Production Services and Operations

We are migrating from 2017.1 to Nice New Iris. Data conversion is fine. However, we would like to do a "global" Enable="false" on all the production's services and operations. Is this possible? Working through the operations and services will be tedious! Any code that can do this would be a great help.

Thanks

Product version: IRIS 2020.1
$ZV: IRIS for Windows (x86-64) 2020.1 (Build 215_0_20466U) Wed Dec 2 2020 14:54:15 EST
Discussion (3)0
Log in or sign up to continue

I've cobbled the following together from other posts that come close to this (for example, here and here) and running each line in terminal should disable all the services from the production in the namespace you run it in:

zn "NAMEOFNAMESPACEHERE"

Set tRS = ##class(%ResultSet).%New("Ens.Config.Production:EnumerateConfigItems")

Set tStatus = tRS.%Execute("Production.Name.Here", 1)

While tRS.%Next(.tStatus) {set sc = ##class(Ens.Director).EnableConfigItem(tRS.%Get("ConfigName"), 0, 1)}

Line 1 sets your namespace, 2 and 3 bring back the list of services (the flag set to 1 on the third line specifies listing the services, setting this to 3 will bring all operations)

Line 4 is a while loop to iterate through the result set and to then use Ens.Director.EnableConfigItem to disable the config item by name (flag 1 is the enable/disable flag, and the second is to tell it to update the production).

This could probably be made nicer and more efficient (eg. disabling all of the config names without updating the production and then updating the production once using "##class(Ens.Director).UpdateProduction()" to avoid doing it once per entry) however I hope it works as a starting point.