×

Please give details of the problem

Skip to content

Task Script Tab

Allows you to configure a script the task must run.

Type
Three types of script are available : Javascript (to execute a JS contained in a file) or new Freemarker (to execute Freemarker contained in a .ftl file) or PDF Transformation to generate a PDF document thanks to a XSL file

info_1 Your javascript file can only use process' variables defined or redefined (a=${a}) as input variable of your script task

info_2 Variables set by your Javascript or Freemarker will be available in P_result.xxx. Id of file created by PDF generation is available in P_result.id

info_3 You can also execute a JS in a Freemarker script <@script env="javascript">a=b; setVariable("c",a);<!--@script-->

info_4 If you have a long running Freemarker script (list over 5000 items for instance), you should use this task since time spent on script execution is not count in total time execution of a process (which is limited to 10 minutes "in memory").

info_5 If you are not familiar with XSL/XSLT, please read this. Here is a site with different templates. Here is a tutorial to create a PDF document from a MS Word template.
Data in RunMyProcess must be a json and not a XML

Url
Enter url of JS, FTL or XSL file (or select a JS/FTL/XSL file hosted on RunMyProcess server or upload a JS/FTL/XSL file on RunMyProcess server).
Example of XSL file :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="catalog">
  <html>
   <body>
    <h2>My CD Collection</h2>
    <table border="1">
     <tr bgcolor="#9acd32">
      <th>Title</th>
      <th>Artist</th>
     </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
     <td><xsl:value-of select="title"/></td>
     <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
    </table>
   </body>
  </html> 
 </xsl:template>
</xsl:stylesheet>

Data source variable
This field is only available if Type is "PDF Transformation". It contains JSON structure to be treated by XSL file to generate a PDF document : ${mydata} for instance.
Example of data :

1
{"catalog":[{"cd":{"title":"My song1","artist":"My artist1"}},{"cd":{"title":"My song2","artist":"My artist2"}}]}

New file name
Name of PDF file generated by task