Author Topic: Update DN annex via AIL with PSDK Bridge  (Read 4679 times)

Offline darmit

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Update DN annex via AIL with PSDK Bridge
« on: October 05, 2015, 01:54:22 PM »
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 = "<ConfData>" +
                "<CfgDeltaDN>" +
                "<CfgDN>" +
              "<DBID value=\"535\"/>" +
                " <userProperties>" +
                "  <list_pair key=\"TServer\">" +
                "  <str_pair value=\"Test-ssAgent\" key=\"display-name\"/>" +
                "  </list_pair>" +
                " </userProperties>" +
                "</CfgDN>" +
                "</CfgDeltaDN>" +
                "</ConfData>";

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

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Update DN annex via AIL with PSDK Bridge
« Reply #1 on: October 05, 2015, 03:04:02 PM »
Hi,

If the option already exists try something like this:

[code]<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>[/code]

Offline darmit

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Update DN annex via AIL with PSDK Bridge
« Reply #2 on: October 06, 2015, 09:07:04 AM »
That's exactly it.
Thanks!

Offline oceanblue

  • Newbie
  • *
  • Posts: 23
  • Karma: 0
Re: Update DN annex via AIL with PSDK Bridge
« Reply #3 on: July 20, 2021, 04:28:42 PM »
@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,


Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Update DN annex via AIL with PSDK Bridge
« Reply #4 on: August 17, 2021, 12:48:02 PM »
Hi,

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

[url=https://docs.genesys.com/Documentation/PSDK/latest/Developer/UsingtheCOMAB]https://docs.genesys.com/Documentation/PSDK/latest/Developer/UsingtheCOMAB[/url]

It makes things much easier..

A sample in C#

[code]
            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}");
[/code]