Versions Compared

Key

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

...

Code Block
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.joget.apps.app.service.AppUtil;

Connection con = null;
try {
    // retrieve connection from the default datasource
    DataSource ds = (DataSource)AppUtil.getApplicationContext().getBean("setupDataSource");
    con = ds.getConnection();

    // execute SQL query
    if(!con.isClosed()) {
        PreparedStatement stmt = con.prepareStatement("UPDATE table1 SET column1='value1'");
        stmt.executeUpdate();
    }
} catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
} finally {
    try {
        if(con != null) {
            con.close();
        }
    } catch(SQLException e) {
    }
}

Participant Type Plugin

Anchor
Participant Type Plugin
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  :

...