1
0
-1

From within a groovy service I'd like to determine the server-name of the TM server running the groovy service. The best way so far I've come up with is to pull it from the database using

select context_path from portal where portal_oid = 1

where portal_oid = 1 is TM, I could also use portal.name = 'Transaction Manager'

Are there better alternatives?

Matt

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hey Matthew, by 'server name' I'm assuming you want the domain or host name.

      Are you in a Dynamic Data Service or standard Groovy Service? If you are in a Dynamic Data service and have access to the HttpRequest you can use PortalUtils.getPortalContext(request) function as follows to get the domain of the form space:

       

       

      If you are in a standard Groovy service you can use the PortalDao class to retrieve a portal by name and get the context path as follows:

       

       

      In Transact 5, you can use the new Fluent API to achieve the same result as follows:

       

       

      You should never access the database directly using SQL.

      1. Ben Warner

        Did this work for you Matthew?

      CommentAdd your comment...