Skip to content
🚀 Rapid Application Development with the App Builder

preInsert

The preInsert hook is executed before a row is inserted. It allows developers to prevent the insert based on custom logic.

Parameters

ParameterTypeDescription
getColumnValuefunctionSee getColumnValue(columnName)
setColumnValuefunctionSee setColumnValue(columnName, columnValue)
setColumnStylefunctionSee setColumnStyle(columnName, cssStyle)
setValidationErrorfunctionSee setValidationError(columnName, errorMessage)
unsetValidationErrorfunctionSee unsetValidationError(columnName)

Return Value

Return false to cancel the insert, or true to proceed with the insert.

✨ Example of a preInsert Hook

This example prevents inserts when the column status has the value "DONE".

js
((getColumnValue, setColumnValue, setColumnStyle, setValidationError, unsetValidationError) => {

	const value = getColumnValue("status")

	if (value === "DONE") {

    	wpda.alert("ERROR", "Insert not allowed!")		// Use built-in alert
        wpda.snackbar("Insert not allowed!", "error")   // Use built-in snackbar
      
        return false

    }

})