One recurring question that comes up after a customer has been using the scripting capabilities of the Axeda Platform for some time is how to create function libraries that are reusable, in order to reduce the amount of copy and pasting (and testing) that is done to create new functionality.  Below I demonstrate a mechanism for how to accomplish this.  Some things that are typically included in such a library are:


  • Customized ExtendedObject access methods (CRUD) - ExtendedObjects must be created before they can be used, so this can be encapsulated per customer requirements
  • DataItem manipulation
  • Gathering lists of Assets based on criteria
  • Accessing the ExternalCredentialsBridge


For those unfamiliar with Custom Objects I suggest some resources at the end of this document to get started.  The first thing we want to do is create a script that is going to be our "Library of Functions":



class GroovyChild {
    String hello() {
        return "Hello"
    String world() {
        return "World"


return new GroovyChild()


This can the be subsequently called like this:



import static com.axeda.sdk.v2.dsl.Bridges.*

CustomObjectCriteria cOC1 = new CustomObjectCriteria()
cOC1.setName 'FunctionLibrary'
def co = customObjectBridge.findOne cOC1
result = customObjectBridge.execute(co.label )

return ['Content-Type': 'application/text', 'Content': result.hello() + ' ' + ]


A developer would be wise to add in null checking on some of the function returns and do some error reporting if it cannot find and execute the FunctionLibrary.  This is only means a a means to start the users on the path of building their own reusable content libraries.



-Chris Kaminski

PTC/Axeda Customer Support