Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import java.sql.*;
import javax.sql.DataSource;

import org.joget.apps.app.service.AppUtil;


Connection con = null;

try {

Class.forName("com.mysql.jdbc.Driver").newInstance();


    // retrieve connection from the default datasource
    DataSource ds = (DataSource)AppUtil.getApplicationContext().getBean("setupDataSource");
    con = DriverManagerds.getConnection("jdbc:mysql://localhost/wflowdb?useUnicode=true&characterEncoding=UTF-8", "root", "root");

);



    // execute SQL query
    if(!con.isClosed()) {
{ System.out.println("Successfully connected to MySQL server using TCP/IP..."); PreparedStatement stmt = con.createStatement(); 
        stmt.executeUpdate("UPDATE formdata_simpleflow set c_status='#assignment.activityId#' WHERE processId='#assignment.processId#'"); 
    }

} catch(Exception e)
{ System.err.println("Exception: " + e.getMessage()); 
} }

finally {

try
{    try { 
        if(con != null) {
            con.close(); 
        }

    } catch(SQLException e) {
    }

}

Participant Type Plugin

A participant type plugin should return a collection of usernames. In the participant plugin there are two context variables available for the script to use  :

...