User bio
404 bio not found
Member since Mar 3, 2021
Replies:

Thanks for the response Kevin. Using this, I have modified my code to disable all the "Alerting" settings ( even though, they might not be present in the Ens_Config.Item table, but present in the Host class settings in mgmt portal(green color))

OID is , OID of the Ens_Config.Item table.
Here is my code.
Let me know, if I have to change anything.

UpdateSetting(Oid) public
{
Set sts = 0
Set tStatus = 0
If ($Get(Oid) '="")
{
Set item=##class(Ens.Config.Item).%OpenId(Oid) If $IsObject(item)
{
Set tSC = item.GetStaticSettings(.pList)
If $$$ISOK(tSC)
{
         Do item.PopulateVirtualSettings()
           Set n0 = $O(pList(""),-1)
           Set = item.VirtualSettings.Count()
           For = 1:1:
           {
            Set pList(n0+i) = item.VirtualSettings.GetAt(i)             //Check the group of this setting and we need only the Alerting group settings
            If ($LIST(pList(n0+i),16)="Alerting")
            {
             Set SettingName = $LIST(pList(n0+i),2)
             Set SettingType = $LIST(pList(n0+i),1)
             Set SettingDataType = $LIST(pList(n0+i),8)
            Set tSetting = item.FindSettingByName(SettingName, SettingType)
            //Write SettingName,!
            //ZW pList(n0+i)
            
            //If the Setting DataType is String set as empty, otherwise zero
            Set SettingValue = $Select(SettingDataType="%Library.String":"",1:0)
            
            //If the setting is present in Ens_Config.Item table/Production Host class, set the value alone, otherwise Populate the setting into it.
            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
Set tStatus = item.Settings.Insert(tSetting)
}
Else {
Set tStatus = tSetting.ValueSet(SettingValue)
}
Set sts = item.%Save()
            
       }        
           }     
     }
}
}
Quit (sts&&tStatus)
}

Certifications & Credly badges:
Purushothaman has no Certifications & Credly badges yet.
Global Masters badges:
Purushothaman has no Global Masters badges yet.
Followers:
Following:
Purushothaman has not followed anybody yet.