Skip to content
🚀 Rapid Application Development with the App Builder

setColumnValue(columnName, columnValue)

Updates the value of the specified column.

Scope: FORM

Parameters

ParameterTypeDescription
columnNamestringThe name of the database table column.
columnValueanyThe new value of the specified column.

Return Value

None

✨ Example of an onRowInit Hook

Applies a default value to column type depending on the users role.

js
((mode, getColumnValue, setColumnValue, setColumnStyle) => {

	if (mode === "INSERT") {
		if (app.userHasRole("admin")) {
			setColumnValue("type", "admin")
		} else {
			setColumnValue("type", "user")
		}
	}

})

✨ Example Updating a Column Value from a Custom Button

The required arguments (...) depend on the specific hook used.

js
((...) => {
  
    const buttonId = 'custom-btn-' + Date.now()
    
    setTimeout(() => {

        const button = document.getElementById(buttonId)
        if (button) {
            button.addEventListener('click', () => {
                app.setColumnValue('location', 'NEW-LOCATION')
            })
        }

    }, 0)
    
    return `<button id="${buttonId}">
        UPDATE LOCATION
    </button>`
  
})