Hi all,
Just wanted to ask your views on ERROR() and TESTFIELD().
I feel that TESTFIELD() error message is not that user friendly. So I prefer to use ERROR() more than TESTFIELD(). Your views?
*This post is locked for comments
Hi all,
Just wanted to ask your views on ERROR() and TESTFIELD().
I feel that TESTFIELD() error message is not that user friendly. So I prefer to use ERROR() more than TESTFIELD(). Your views?
*This post is locked for comments
Hi,
My bad. Thank you for correcting me.
Hey Nareshwar,
You cant use TESTFIELD for your custom variables. It's only for Record.FIELD.
Check out this link.
https://msdn.microsoft.com/en-us/library/dd301274.aspx
Hope this helps.
Thanks
Hi,
As Saurav explained, you can use TESTFIELD() for your custom variables such as, TESTFIELD(MyInt,5).
Thank you for your response, anyways.
Hi Saurav,
Thank you for valubale input. I always try to implement error messages through TESTFIELDS() rather ERROR() until my the end users complain about the user-friendliness.
Kudos to you.
Hi Natalie,
Thank you so much for the reply. Will try using FIELDERROR();
Hey Nareshwar,
There's a very clear difference between TESTFIELD and ERROR, TESTFIELD you can apply only to Record.Fields but Error you can use it anytime anywhere.
Every time for ERROR you have to give your custom Message whereas TESTFIELD will handle itself.
If you will ask from Performance and code optimization point of view i will recommend to use TESTFIELD on most of the cases wherever you can.
Thanks
Hi,
It actually depends on situation -
1. Testfield will give you an error message with the Primary key of the Table.
2. TestField is not only used to check value is there or not, it also allow you to check a specified value like -
TestField(MyInt,5) if not 5 you get an error.
3. With Error you can write your on Error Messages but that depends on how different users will interpret what you write in Error Message.
4. When you use error you need to additional line of code to Test the condition, not measure but it adds a load to run that condition.
To Summarize, Use Error when you actually think it make sense like Sales Line where new users will not know what is line no and all, but what about Microsoft Testfields..
Lol yes you cannot remove all of those for sure but for setup / Master tables or Table does not have Composite key, i think TestField is the best option
Hope i am making sense.
You can use FIELDERROR instead.
It combines the automatic output of the affected record, with an individual text before it.
Example (related to TESTFIELD): <Your field> "should be bigger than field X" <in table Y, primary key fields>.
Hi,
This depends on the various programming conditions & related output.
Testfield would give you common message across NAV, where as Error message text would depends on the programmer, however would be more meaningful to end user.
If you feel, Error is more helpful, you can certainly go ahead and define your own message.
Refers following link for more details.
www.archerpoint.com/.../pierrot-le-fou-testfield-and-error-messages-microsoft-dynamics-nav
Hope this helps.
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,403
Most Valuable Professional
nmaenpaa
101,156