/
JSON onEditJSON Function
JSON onEditJSON Function
You can use a new JSON entry point called onEditJSON on the onEdit event of a record. The onEditJSON function validates a value or formula as follows:
- If the result is True, then the record enters edit mode and you can edit the record.
- If the result is False, then the record does not enter edit mode and you cannot edit the record.
The onEditJSON function in the following example code disables edit when the account type is equal to HMO.
<html><head><title>onEdit example</title><script type="text/javascript"> /** disable edit if accounttype = HMO **/ function onEditJSON() { return "[{\"action\":\"select\",\"invoke\":\"checkCondition\",\"parameters\":[{\"modulefields\":[{ \"module\":\"1\", \"fields\":\"ACCTKW01\"}],\"filter\":\"1.uid=$1.uid\"}]}]"; } function checkCondition(row) { var result; result = "true"; if(row. length>0){ if(row[0]._1.ACCTKW01 == "HMO") { window.location = "melt://showAlert/No Edit Allowed"; result = "false"; } } return "[ {\"action\":\"validate\",\"result\":\"" + result + "\"} ]"; } </script></head><body></body></html>
, multiple selections available,
Related content
JSON onCreateJSON Function
JSON onCreateJSON Function
More like this
JavaScript onDelete Function Example 2: Checking Multiple Conditions
JavaScript onDelete Function Example 2: Checking Multiple Conditions
More like this
The onEdit Function in JavaScript Code
The onEdit Function in JavaScript Code
More like this
JavaScript onDelete Function Example 1: Checking a Single Condition
JavaScript onDelete Function Example 1: Checking a Single Condition
More like this
JavaScript onPreSave Function Example 3: Checking a Parent
JavaScript onPreSave Function Example 3: Checking a Parent
More like this
JavaScript onSave Function Example 1: Nonconditional Data
JavaScript onSave Function Example 1: Nonconditional Data
More like this