So you want to know the name of a current host from inside of it?

Business host has a %ConfigName property which you can access.

For example in BPL process you can trace the HostName like this:

 <trace value="process.%ConfigName"/>

And here's  the result:

In simple BP, BS and BO you can access current HostName with:

write ..%CinfigName

That said, why do you need to get the name of a current host from inside of it?

You need to use

set tSC=##class(EnsPortal.Utils).ItemSettings("Production.Name||Item.Name",.settings,.colNames)

Where ProductionName  is Production class. If ProductionName is not given, then the currently running or last run Production will be used. Item.Name is config name, not class. In your case you can call:

set tSC=##class(EnsPortal.Utils).ItemSettings("My.BP.AA",.settings,.colNames)

To get the settings of My.BP.AA host.

I have not found the function (NameExists) in the documentation

Note, that the index "Name" is defined in this class. <Index>Exists is just an automatically generated method that returns a boolean  (Passed index value exists). You can read more about autogenerated methods here.

Everything seems fine.

I'd recommend checking with HTTP Debugging proxy what request actually gets sent. Article on that.

tl;dr plan:

  1. Install Charles proxy (or Fiddler).
  2. Start it.
  3. Redirect your BO traffic to the proxy port.
  4. Check what is actually sent.

Alternatively if you can run the BO locally you can modify the outbound adapter to send the request with Test=1 value and check what's sent.