Fieldref Validate Exception Handling

sryssrys Member Posts: 2
Hi,
We have created a funtionality to Copy Data between 2 Tables using RecRef/Fieldref..

The SourceTable is known, as created by us, but the destination table, can differ, especialy the Code inside the triggers.

Our Code contains a line like this:
IF TempSyncField."Validate Trigger" THEN
                  TargetFieldRef.VALIDATE;
Unfortunatly, if there is a code inside the Table Validate, that throws an Exception (like runtime Error) our code will send back a strange error message, that is not very helpful. :-(

Is there any "Workaround" to check exceptions from this code, without breaking the run of the code?
Thanks for any hints.
Stephan

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Can you use the debugger to find out on which command it goes wrong (and post the code)?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • rdebathrdebath Member Posts: 383
    The only ways to catch errors are using the X := CodeunitVar.RUN structure and a similar one with XMLPorts.

    If a CodeunitVar.RUN returns false (ie an error was caught) GETLASTERROR will have the error message and you can call functions in the codeunit to extract variables and workout where it got to.

    That way you should be able to give an error message like:

    Error Validating the value 'N/A' into the "BB Code" field on the "Customer" table : BB Code does not exist.
Sign In or Register to comment.