Warning function

About Warning function

You use the Warning function to create warnings in Control or Modify rules.

As opposed to an error, a Warning allows the user to keep the value and leave the field in the GUI.

newWarning(code, message, args)

Description Creates a new warning and adds it to the warning list returned by the rule-based function.
Syntax newWarning(code, message, args)
Return

Warning.

Parameters

code: Warning code.

message: Warning message (used if the warning code is not found in the dictionary).

args: Variable number of message arguments.

Example

The following example assigns variables to the properties so that the properties of the new element can be read or set.

if PROP1 is null then

warn = newWarning(“nullProperty”, “property PROP1 is null”)

warn.field = “PROP1”

warn.customProp1 = “p1”

The following example that uses placeholders and arguments returns a warning with the message: “p1 = 10, p2 = 20”.

newWarning(“warn.code”, “p1 = {0}, p2 = {1}”, 10, 20).

Related Links