Urgent Help - Unable to find/update Ensemble settings using Ens_Config.Item class programmatically for all Business Hosts
I have a requirement to update the Ensemble Host Settings Programmatically. Mainly the
I used Ens_Config.Item (persistent) class to get the settings (list object) and then update it. But for some of the Business Host's, I dont see the above settings in the table, but present in Settings of that particular Host in Ensemble Management Portal. So my logic is not working.
Why is that and how to write a code to update the above settings for all the hosts ?
Please let me know the way to achieve my requirement.
My code.
Write Oid,!
If ($Get(Oid) '="")
{
Set item=##class(Ens.Config.Item).%OpenId(Oid)
Set tSetting = item.FindSettingByName(SettingName, SettingType) //Write tSetting,!
If (tSetting = "")
{
Write "Unable to find the Setting : """_SettingName_""" for the SettingType : "_SettingType,!
Quit
}
If '$IsObject(tSetting) {
Set tSetting = ##class(Ens.Config.Setting).%New()
Set tSetting.Name = SettingName
Set tSetting.Target = SettingType
Set tStatus = tSetting.ValueSet(SettingValue)
If $$$ISERR(tStatus) Quit tStatus
Set tStatus = item.Settings.Insert(tSetting)
}
Else {
Write "In else",!
Set tStatus = tSetting.ValueSet(SettingValue)
}
Set sts = item.%Save()
Write "Save status : "_sts,!
Write tStatus,!
}
//Update Production after the setting change.
Write ##class(Ens.Director).UpdateProduction(),!