1
0
-1

Hi Guys,

I have tried several options but can't get a handle on a portal property using the submission object in a form's Confirmation Page URL.

P.S. I actually wanted to get an Org property but can see there is not actually a getPortalProperty method on the _Client but there is a getPortalProperty method on the _Portal class

 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Jim,

      You could try:

      $submission.getPortal().getPropertyMap().get("<your property name here>")

      You can also get at Form Version properties in a simmliar manner:

      $form.getCurrentVersion().getVersionPropertyMap().get("<your property name here>").getTextValue()

      But, yes unfortunately there doesn't appear to be Map-based access to Organisation properties via Submission object (these are supplied as a List instead).

      Cheers,

      Matt

       

       

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Using the a portal property from the context of a submission as an example, we would use this in the velocity template

        ${submission.portal.getPortalProperty("PortProperty").value}

        This will retrieve the portal property 'PortProperty' for the portal associated with the submission.

         

        The important thing to note when using velocity notation is when you can use the shorter notation. When using a method that is not passed a parameter, such as the .getPortal() method on the submission object, you can use the shorter notation .portal. However if the method you are using requires a parameter, such as the getPortalProperty(String portalProperty), you need to use the full method call.

         

        You can use the following groovy code to experiment with and test your velocity templates.

         

        import com.avoka.fc.core.dao.DaoFactory
        import com.avoka.fc.core.entity.Submission
        import com.avoka.core.util.StringTemplate

         

        def submission = DaoFactory.getSubmissionDao().getSubmissionByTrackingNumber("XXXXXX")
        println "submission.getId():" + submission.getId()

         

        def templateStr = '${submission.portal.getPortalProperty("PortProperty").value}'
        def model = ["submission":submission]

         

        StringTemplate template = new StringTemplate(templateStr)
        println "velocity string = " + template.merge(model)

         

        Josh