Menu

1 / 2

🛡️ Stock Open and Closed Validation in Joget

DEV Community·Explorer·6 months ago
#dy1VnnCC
#java#nocode#sql#tutorial#import
Reading 0:00
15s threshold

Overview

Managing stock levels across multiple branches requires strict controls to prevent data duplication. This script provides a validation layer that ensures business rules are followed before a new entry is saved.

How It Works

The script acts as a BeanShell Validator that executes two primary database checks:

Open Status Check : It queries the database to see if any entry for the selected branch is currently marked with a status of 'Open'.

Daily Duplicate Check : It verifies if a record has already been generated for the branch on the current calendar date using the CURDATE() SQL function.

Where to Use in Joget

Form Builder : Attach this script to the Branch Selection field (or the primary identifying field) using the BeanShell Validator plugin.

Full Code

import java.sql.Connection ; import java.sql.PreparedStatement ; import java.sql.ResultSet ; import javax.sql.DataSource ; import org.joget.apps.app.service.AppUtil ; import org.joget.apps.form.model.Element ; import…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.