AnsweredAssumed Answered

Pass params to a JavaScript

Question asked by chicco0386 on Mar 9, 2011
Latest reply on Jan 18, 2013 by richhart
Hi, I've this function that execute a script:
private String startWorkflow(Reference refUponWF) throws RepositoryFault, NumberFormatException, RemoteException, WebServiceException, Throwable {

      log.info("startWorkflow, entrato");
      String toReturn = "";

      try {
         String nomeScriptWF = "prova.js";
         // return the reference to the script
         List<Reference> scriptSearchResults = RepositoryUtils.searchLucene("/Data Dictionaty", nomeScriptWF);
         if (scriptSearchResults.isEmpty()) {
            throw new Exception("Non posso eseguiro lo script perchè NON ho trovato nessuno script con nome [" + nomeScriptWF + "]");
         }
         Reference script = scriptSearchResults.get(0);
         toReturn = ActionUtils.executeScript(refUponWF, script);
         log.info("startWorkflow, risultato " + toReturn);
      } catch (Throwable t) {
         log.error("startWorkflow, errore generico.", t);
         throw new Throwable("Errore generico. Class: " + t.getClass().getName() + " Message: " + t.getMessage());
      }

      log.info("startWorkflow, uscito");
      return toReturn;
   }

It works fine, but how can I do for pass some params to the scripts?
After the script will go to read the passed params like this:
var param = args["paramName"];

CAN YOU HELP ME?
IS IT POSSIBLE?
THANK YOU

Outcomes