How to disable gui messages?

sjensjen Member Posts: 49
Hello,

How can I disable GUI messages during import?
I am working on Nav 2009 R2 and created an xml port to import sales invoices and during import, I get a message it says You may have changed a dimension. Do you want to update the lines? I do not wish to see this message.

I traced the code and saw that salesperson onvalidate calls update dimensions function from table 357 Document Dimension. It checks for GUIALLOWED or not. I know GUIALLOWED is not property but is there anyway I can set it false? The code below didn't work for me
Ok := GUIALLOWED;
Ok := FALSE;

so I changed the source code in table 357 document dimension, added sethidevalidationdialog but still no luck,
IF UpdateLine <> UpdateLine::Update THEN
  //IF GUIALLOWED THEN (orj code)
  IF NOT HideValidationDialog AND GUIALLOWED THEN 
    IF ShippedReceived THEN BEGIN
      IF NOT CONFIRM(Text006,TRUE) THEN
        EXIT
    END ELSE
      IF NOT CONFIRM(Text003,TRUE) THEN //this line cause a problem
        EXIT;


Text003	You may have changed a dimension.\\Do you want to update the lines?

Best Answers

Answers

  • DenSterDenSter Member Posts: 8,164
    Sounds to me like you can just comment out (or remove) the confirmation message altogether
  • sjensjen Member Posts: 49
    I tried that and I know it works but I don't want to change the source code, I only want to disable it for my import.

    Maybe I should do something after END ELSE statement?

    Thank you for your answer Daniel!
  • sjensjen Member Posts: 49
    edited 2020-02-27
     HideValidationDialog := TRUE;
    
    IF UpdateLine <> UpdateLine::Update THEN
      IF NOT HideValidationDialog THEN
        IF ShippedReceived THEN BEGIN
          IF NOT CONFIRM(Text006,TRUE) THEN
            EXIT
         ELSE
            IF HideValidationDialog THEN
              EXIT
        END ELSE
            IF NOT CONFIRM(Text003,TRUE) THEN
              EXIT;
    

    It works like the code above my but I want to set to validation dialog from the import.

    I called from the import but it passes as "False" even though I coded like that:
    DocDimensionRec.RESET;
    DocDimensionRec.SETRANGE("Table ID",36);
    DocDimensionRec.SETRANGE("Document Type",DocDimensionRec."Document Type"::Invoice);
    IF DocDimensionRec.FINDSET THEN
      DocDimensionRec.SetHideValidationDialog(TRUE);
    

    Any clues on how to set hidevalidation true from the import?
    Thank you so much
  • DenSterDenSter Member Posts: 8,164
    you need to define the condition under which the dialog is displayed and program it that way. If you never want to see the dialog, then there is never a condition under which the dialog is displayed, so what's the point in having the dialog there at all?

    The way you've got that code, you are setting HideValidation only for the first record.
  • sjensjen Member Posts: 49
    yes, I never want to display that dialog when I use my import but the problem is that dialog is in table 357 Document Dimension, that's why I added a new condition to the table.

    ELSE
    IF HideValidationDialog THEN
    EXIT

    I also added repeat and UNTIL DocDimensionRec.NEXT = 0; to get all records, but still, it takes HideValidationDialog as false instead of true.

    Thank you so much Daniel for you help!

  • sjensjen Member Posts: 49
    Wisa123 wrote: »
    Hard to analyze without having the running code in front of me:

    Is there any chance you have a Local AND a Global Variable named "HideValidationDialog"
    So that you would set the local one in your SetHideValidateionDialog-Function and use the global one in the main Code (which would be false either way).

    Weird one, but that would explain the behaviour you encounter.

    I know I have done that once before :)
    I checked but there is only one HideValidationDialog and that's a global variable.
    SetHideValidationDialog(NewHideValidationDialog : Boolean)
    HideValidationDialog := NewHideValidationDialog;
    
    Thank you

  • sjensjen Member Posts: 49
    DenSter wrote: »
    We're only seeing a tiny bit of your code, so it's anyone's guess what is happening. I would suggest to debug the process and set a watch on that variable to see when it changes.

    You are right Daniel, I am not very clear here.

    I am running NAV 2009R2 and using XMLport from RTC 2009R2 so I can't use the debugger but I created a form and put my code there and it returns HideValidationDialog to yes.

    I will look at it more.

    Thank you so much for your help and time.

  • A_l_e_xA_l_e_x Member Posts: 4
    Maybe you can test on the Property "CurrFieldNo" ==>
      HideValidationDialog = ( rec."CurrFieldNo" = 0);
    
    //If user input => it will be <> 0 otherwise = 0
Sign In or Register to comment.