Skip to main content
1-Visitor
May 25, 2021
Solved

Thingworx Directory Services - Issue In Invoking AD Services From Other Things

  • May 25, 2021
  • 1 reply
  • 2173 views

Hello,

 

I have this scenario wherein I have to configure the Thingworx Directory Service  settings programmatically.

 

So, when a user specifies a setting from the UI, I need to update it into the respective configuration table on the Directory service.

However, I need to call these services from inside another thing.

 

When I invoked the services from another thing, all services from my Directory Service entity errored out with -  Error executing service <serviceName>. Message :: ReferenceError: "DirectoryServices" is not defined. 

 

For example even the GetConfigurationTables services gives an error -

 

// result: INFOTABLE dataShape: "EntityList"
var result = DirectoryServices["Test.ActiveDirectory"].GetConfigurationTables();

 

Is this the default working for directory services in Thingworx or is there anything I am missing ?

 

Any help is highly appreciated.

Thanks!

 

Note: Thingworx version is 8.5.6.

Best answer by PaiChung

If I'm not mistaken you are running into a bug unfortunately.

https://www.ptc.com/en/support/article/CS303447?&language=en&posno=1&q=%22DirectoryServices%22%20is%20not%20defined.&source=search

As a work around that you can potentially use is to invoke it using the content loader functions (REST call)

However this bug is fixed in 9.0.x ? so I recommend using a more recent version of Thingworx.

1 reply

22-Sapphire I
May 26, 2021

I don't have an instance with AD set up to check this but check the following

<server>/Thingworx/DirectoryServices/Test.ActiveDirectory

And then go into Service Definitions to see if there are any.

Although I imagine you got the service using the 'Browse'?

Could you at all be running into any permissions issues?

1-Visitor
May 27, 2021

Hi Pai,

 

I checked and yes, I get all the service definitions listed for the Active Directory instance.
If I execute the service from the Active Directory Entity directly, then it works.

 

The problem is only when I try to execute the services from inside another thing.

 

The user I am using is a member of Administrators group.

PaiChung22-Sapphire IAnswer
22-Sapphire I
May 27, 2021

If I'm not mistaken you are running into a bug unfortunately.

https://www.ptc.com/en/support/article/CS303447?&language=en&posno=1&q=%22DirectoryServices%22%20is%20not%20defined.&source=search

As a work around that you can potentially use is to invoke it using the content loader functions (REST call)

However this bug is fixed in 9.0.x ? so I recommend using a more recent version of Thingworx.