xRec and FIELDNO
When a user-defined function or a trigger is executed on a table object, xRec and FIELDNO are set differently, depending on how the function or trigger is executed. The following tables explain what happens in the different scenarios.
The following table explains what happens to xRec and FIELDNO when a user-defined function on a table object is called from either external or internal C/AL code. External C/AL code means that the calling code is in a different object. Internal C/AL code means that the calling code is in the same object (another function in the same object).
| Execution initiated by | xRec value | FIELDNO value |
|---|---|---|
|
External C/AL code |
Empty |
0 |
|
Internal C/AL code |
Unchanged |
Unchanged |
The following table explains what happens to xRec and FIELDNO when a trigger is called from either external or internal C/AL code. External C/AL code means that the calling code is in a different object. Iinternal C/AL code means that the calling code is in the same object (another function in the same object).
| Scenario | xRec value | FIELDNO Value |
|---|---|---|
|
VALIDATE trigger called by external C/AL code that calls the VALIDATE function |
Copy of Rec before assignment in VALIDATE trigger |
Field number of field being validated |
|
VALIDATE trigger called by internal C/AL code that calls the VALIDATE function |
Unchanged |
Unchanged |
|
Any table or function called by C/AL that initiates a call to a trigger other than VALIDATE |
Copy of Rec before trigger is executed |
0 |