Hi all,
I have created a new custom API page, and I have seen in a book and in the standart API pages that
exit(false) is used in OnInsertRecord(BelowxRec: Boolean): Boolean on API pages.
Could you please tell me why is like that. In which cases I have to use exit(false) ?
Thanks
Ivona
Answers
The return value behaves the same for all 3 database related triggers (i.e. the ones shown above).
Microsoft's documentation on this is completely wrong. Here is, what the documentation for NAV 5.0 had to say (This was for a Form, not a Page, but it is still the same.)
Even back then, the documentation for the BelowxRec parameter was wrong, as it still is, and even missing from the function's signature as given in the documentation. But, at least, the effect of the return value is described correctly here.
thanks for the feedback, but just as Info:
when I removed the exit(false) from OnInsertRecord(BelowxRec: Boolean) on API page, I was not even able to insert a new record from the postman.
I was getting the following error message:
Regards
As the documentation says:
- the default return value is true
- if you return true, the system will insert the record
It is standard behavior that you (or the system in this case) get the error "The record ... already exists" if you try to insert a record with a primary key that already exists in the database, which is true as soon as you INSERTed the record.
Thanks a lot. I got your point now
Have a nice weekend