Update DN annex via AIL with PSDK Bridge

Hello.

I’m trying to update annex of a DN with AIL+PSDKBridge.
So far I found the way to add value to annex via RequestUpdateObject with following xml
String xml = “” +
“” +
“” +
“<DBID value="535"/>” +
" " +
" <list_pair key="TServer">" +
" <str_pair value="Test-ssAgent" key="display-name"/>" +
" </list_pair>" +
" " +
“” +
“” +
“”;

Works fine unless there is already a “display-name” option defined.
How should I change xml so it would update existing value?

Thanks in advance

Hi,

If the option already exists try something like this:

<ConfData>
  <CfgDeltaDN>
    <CfgDN>
      <DBID value="2266"/>
    </CfgDN>
    <changedUserProperties>
      <list_pair key="TServer">
        <str_pair key="display-name" value="Test-ssAgent"/>
      </list_pair>
    </changedUserProperties>
  </CfgDeltaDN>
</ConfData>

That’s exactly it.
Thanks!

@PeteHoyle @darmit

I wanna do the exact same thing (that you guys showed in XML) using plain Java PSDK. So, basically i want to update some DN properties from under the “TServer” section under the DN option tab in GA

I have tried the sample code provided in the psdk dep guide for updating an Object without success. For example, if I do this :

obj.setPropertyValue(“contact”, “certain value”);

It says attribute contact cannot be found! I guess i will have to create a deltaDN structure first, or may be there’s a better way of doing this.

I would appreciate any input you can provide.

Thanks,

Hi,

I would recommend that you use the PSDK Configuration Object Model Application Block

https://docs.genesys.com/Documentation/PSDK/latest/Developer/UsingtheCOMAB

It makes things much easier..

A sample in C#


            CfgDNQuery query = new CfgDNQuery();
            query.DnNumber = dnId;
            CfgDN dn = confService.RetrieveObject<CfgDN>(query);
            if(dn == null)
            {
                log.Error($"Could not Find the DN {dnId}");
                return;
            }
            KeyValueCollection annex = dn.UserProperties;
            KeyValueCollection mySection = null;
            if (annex.ContainsKey(sectionName))
            {
                mySection = annex.GetAsKeyValueCollection(sectionName);

            }
            else
            {
                mySection = new KeyValueCollection();
                annex.Add(sectionName, mySection);
            }
            if (mySection.ContainsKey(keyName))
            {
                mySection.Remove(keyName);
            }
            mySection.Add(keyName, value);
            dn.Save();
            log.Info($"Updated DN: {dn}");