1
0
-1

Hi! I have two different types of services and I want to access a property from the Form Space. I tried to do it like this :

String value = new PropertyQuery()
.setName("Service property")
.setSpaceName(txn.spaceName)
.getValue()

The problem is that what happen in the groovy services that I don't have a transaction?, and what happen when I call a service that I don't send any transaction?

Is there a way to access the property "Service property" for all kind of services in the same way?


  1. Unknown User (bfrost)

    Hi Fabiola,

    What types of service are you implementing?

CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1
    Hi Fabiola, 
    An alternative approach whereby you access the space then pull the resources for instance:

    def space = DaoFactory.portalDao.getPortalByName(portalNameHere)

    Then you can access say resources of this space thus:

    def resource = DaoFactory.portalResourceDao.getPortalResourceByPath(space.getId(), pathAsString)

    Hope this helps you move forward or generate some ideas for you.

    Thanks

    Petros

    1. Fabiola Ansara

      Hi Petros! Thanks for your answer.

      Is there a way that I don't have to hard code the portal name? Because I need this property in different environments and they have different form spaces name, so It make it more difficult. 

      I was thinking something like get current form space but I couldn't find how.


    2. Petros Christou

      Hi, there should be a way to return these as a list and iterate through.

    3. Howard Treisman

      Hi Petros and Fabiola

      1. Can you give a little more context about this question? When is the service being called?
      2. Why do you not have the transaction? Is there no transaction parameter, or is the parameter null?
      3. If there is no transaction, does that mean that the service is not being invoked as part of a transaction? And does that in turn imply that we cannot find the "current" portal name, because there isn't one?

    CommentAdd your comment...