Skip to main content
7-Bedrock
April 13, 2025
Solved

Things is not defined.

  • April 13, 2025
  • 2 replies
  • 1397 views

In an Expressions function: ExistentPTO in a Mashup X,

I have a need to evaluate the payload on a call to a route (from another project: ToolB).

response = Things["ToolB.v6DocMgmt"].getDocuments({

...

...

});

if (JSON.stringify(response)[value] == []) {

    output = "Not a good number";

} else output = <target mashup name>;

 

When viewing the mashup, i get this in the logs:

19:06:28 WARN - Evaluation of expression "ExistentPTO" Failed. Things is not defined

 

Can I NOT use Things within an Expression function? How do i refer to a Thing in another project?

 

 

    Best answer by Ascherer17

    Expressions are executed on the "client" side (the user's browser) meaning you only have access to Expression inputs that you feed in and some items that are part of the browser. Whereas Services (defined on a Thing) run on the actual Thingworx server, so they can access your Thingworx model.

     

    It sounds like you may want to create a Service to perform the desired function and call it from your mashup.

    2 replies

    Catalina
    Community Moderator
    April 17, 2025

    Hi @Socka_HW 

    Thank you for your question. 

    Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

    Also, feel free to add any additional information you think might be relevant. It sometimes helps to have screenshots to better understand what you are trying to do.

     

    Best regards,

    Catalina | PTC Community Moderator
    16-Pearl
    April 22, 2025

    Expressions are executed on the "client" side (the user's browser) meaning you only have access to Expression inputs that you feed in and some items that are part of the browser. Whereas Services (defined on a Thing) run on the actual Thingworx server, so they can access your Thingworx model.

     

    It sounds like you may want to create a Service to perform the desired function and call it from your mashup.

    Socka_HW7-BedrockAuthor
    7-Bedrock
    October 6, 2025

    I created a Service (with the desired functionality) and called it from my Mashup..
    All is well ... 

     

    thank you.