1
0
-1

I am trying to call a Function from my Form Open function based on the documentation. I want to include my own parameters when calling the function so I try and add values to my existing param.params object; however, it always fails with an:

"java.lang.UnsupportedOperationException"  error.

Does anyone have a simple, working example of using the FluentFuncInvoker() with your own additional parameters?

   FuncResult invoke(FuncParam param) {

................

//TODO: Part 4 - Add custom parameters
param.params.put("countries",(Object) "us")

FuncResult resultFunFact = new FluentFuncInvoker()
.setServiceName("getFunFact")
           .setVersion("0.1.0")
           .invoke(param)


FormFuncResult result = new FormFuncResult()
logger.info "Result is ${result}"
return result
}



    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Engineering pointed out that the objects in the param (except for the parama.appDoc which contains the XML) are immutable. So to accomplish what I wanted, I needed to create a new FuncParam object and use that to call my other function


      FuncResult invoke(FuncParam param) {

      ................
      //TODO: Part 4 - Uncomment Map objects used to build new FuncParam param
      // to pass to the other function
      def countries ="us" //Hard code value for now
      def map = [:]
      map['data']= 'bigmac_index'
      map['countries']= countries
      map['years']='2014'

      //TODO Part 4 - Build new FuncParam and call the function
      FuncParam funcParam = new FuncParam(null, xmlDoc.document, map, param.request, param.svcDef, param.txn, param.user);



      FuncResult resultFunFact = new FluentFuncInvoker()
      .setServiceName("getFunFact")
      .setVersion("0.1.0")
      .invoke(funcParam)
        CommentAdd your comment...