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)
}

I could see the reason behind this. 
Whatever setting present in the Production class Xdata block, those only available in the Ens_Config.Item table->Settings column
So the real question now is, How do I Update the settings, which are not present in the Production Class/Ens_Config.Item, but showing as a setting for the Business Host in management Portal through a piece of code.

E.g

Production XData block

 <Item Name="OPR_ALL_SMM_MLA" Category="SMM_ADT,SMM_ORM" ClassName="SJHLIB.Operation.HL7.TCPOperation" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Host" Name="LoggingTarget">OPR_LOG_SOCAL_OPR</Setting>
    <Setting Target="Host" Name="ApplicationName">MLA</Setting>
  </Item>
  
  Ens_Config.Item
  
  *LoggingTargetHostOPR_LOG_SOCAL_OPR ApplicationNameHostMLA

Production XData block

<Item Name="test" Category="" ClassName="EnsLib.HL7.Operation.HTTPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Adapter" Name="HTTPServer">localhost</Setting>
    <Setting Target="Adapter" Name="HTTPPort">30021</Setting>
    <Setting Target="Adapter" Name="Credentials"></Setting>
    <Setting Target="Adapter" Name="URL"></Setting>
    <Setting Target="Host" Name="ArchiveIO">1</Setting>
    <Setting Target="Host" Name="AlertOnError">1</Setting>
    <Setting Target="Host" Name="InactivityTimeout">10</Setting>
    <Setting Target="Host" Name="QueueCountAlert">10</Setting>
    <Setting Target="Host" Name="QueueWaitAlert">10</Setting>
    <Setting Target="Host" Name="AlertRetryGracePeriod">10</Setting>
    <Setting Target="Host" Name="AlertOnErro">0</Setting>
    <Setting Target="Host" Name="PoolSize">1</Setting>
    <Setting Target="Host" Name="PoolSiz">1</Setting>
  </Item>

Ens_Config.Item

"""HTTPServer Adapterlocalhost" HTTPPort Adapter30021 Credentials Adapter URL Adapter ArchiveIOHost1 AlertOnErrorHost0 InactivityTimeoutHost0 QueueCountAlertHost0 QueueWaitAlertHost0 #AlertRetryGracePeriodHost10 AlertOnErroHost0 PoolSizeHost1 PoolSizHost1

Any help is appreciated.

Hi Kevin,
Yes, FindSettingsByName method is giving empty for some items. 
They are showing Green color in the mgmt portal. I also couldnt find them in the Settings value of Ens_Config.Item table.  It gives only few settings values. E.g below

*LoggingTargetHostOPR_LOG_SOCAL_OPR ApplicationNameHostHSC RetryIntervalHost30


It's a custom Operation class (extends EnsLib.HL7.Operation.TCPOperation) in which the Alert properties are overridden.

It's not working for a host which has class name of EnsLib.HL7.Operation.FileOperation , but it works for EnsLib.HL7.Operation.HTTPOperation, since it shows those settings in Ens_Config.Item table.

I need to find out, what are the cases, in which the Alert Settings are not showing in the Ens_Config.Item table.

Appreciate any help. We can connect directly, if you want. Let me know your availability through email.

In the Ens_Config.Item table, For the same underlying custom TCP operation class, I see one entry has these Alert Settings and other doesnt have all of the Alert Settings.
I am not sure, what's the reason behind this .

ReplyCodeActionsHost:~=C #ApplicationNameHost Initiate *LoggingTargetHostOPR_LOG_SOCAL_OPR AlertOnErrorHost1 %AlertRetryGracePeriodHost1200 InactivityTimeoutHost60 QueueCountAlertHost30 ReconnectRetry Adapter5 RetryIntervalHost60

 

 

ApplicationNameHostCAC *LoggingTargetHostOPR_LOG_SOCAL_OPR AlertOnErrorHost1