Ignore messages while importing by using SetHideValidationDialog.

sjensjen Member Posts: 53
Hello I am using NAV 2009R2 and I have an xmlport to import sales invoices and i would like to ignore any messages while I import.

I used SetHideValidationDialog(TRUE) right before validate lines for the sales header and for the sales line but I still get one message while I am importing. I traced the code and it has something to do with salesperson code I believe.

rbmp5qulh7rw.png

Any clues on how to hide this message?
Thank you

Answers

  • txerifftxeriff Member Posts: 500
    Hi,

    I would recomend to debug the code to indentify what tables are populating those messages and try find hide dialog functions like the one you tried to call in the tables.

    SetHideValidationDialog() is not a magic function (but comes with the standard), it just sets HideValidationDialog variable to TRUE so in every CONFIRM() of the code is skipped. However, if there is custom code, you may need to change it.
    Also keep in mind GUIALLOWED system function.
  • sjensjen Member Posts: 53
    Hi @txeriff,
    Thank you for your input.

    Let me explain a little bit more. I also had another discussion here and Daniel helped me but I still couldn't find a solution.
    https://forum.mibuso.com/discussion/comment/330622#Comment_330622

    During my xmlport salesperson code validate code has a logic and it goes to table 357 Document Dimension and
    IF UpdateLine <> UpdateLine::Update THEN
      //IF GUIALLOWED THEN (orj code)
      IF NOT HideValidationDialog AND GUIALLOWED THEN // I added this line
        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?
    

    executes the code above. What I am trying to do is skip this part of code while I import my sales invoices but whatever I did I couldn't achieve. I don't want users to see any messages. I already have the code below before the validate fields in my xmlport
    salesHeader.SetHideValidationDialog(TRUE);
    salesLine.SetHideValidationDialog(TRUE);
    

    I also added DocDimensionRec.SetHideValidationDialog(TRUE); to my xmlport and I am seeing it sets SetHideValidationDialog to TRUE before import but while import it sets to false.

    Is there any way you can think of I can skip that message box?

    in my other post, I mentioned that I set GUIALLOWED to false in my xmlport but still during import I think it sets itself to TRUE.
    Ok := GUIALLOWED;
    Ok := FALSE;
    

    Thank you
  • txerifftxeriff Member Posts: 500
    edited 2020-03-04
    Hi ,

    If you debug it, you would see.

    the line that says "//this line cause a problem"

    to the last ELSE add the following (sorry but TAB key does not work in here);
    else begin
    if (hidevalidationdialog=false) and (GUIALLOWED) then begin
    if not confirm(Text0003,true) then
    exit;
    end;
    end;
  • sjensjen Member Posts: 53
    Thank you for correcting, however during import it still displays the message. I know the code is correct now but maybe I am missing something in my xmlport?

    I can't debug since it's an xmlport and I have to run from RTC
    IF UpdateLine <> UpdateLine::Update THEN
      IF NOT HideValidationDialog AND GUIALLOWED THEN 
        IF ShippedReceived THEN BEGIN
          IF NOT CONFIRM(Text006,TRUE) THEN
            EXIT
        END ELSE BEGIN
           IF NOT HideValidationDialog AND GUIALLOWED THEN BEGIN
            IF NOT CONFIRM(Text003,TRUE) THEN 
              EXIT;
            END;
        END;
    
  • txerifftxeriff Member Posts: 500
    Hi,

    oh I see, xmlports on NAV 2009... I forgot about that..

    Are you sure the message is CONFIRM(Text003) what you are getting?

    i can recomend to add some traces to "debug" : Message(' pass');

    you can add different messages and see them to trace what code is doing.

    Try to MESSAGE(format(HideValidationDialog )) before all the IF updateline<>updateline::Update
    this way you will see if hidevalidationdialog has really true value.

    the other way is try convert it partially to dataport?
  • sjensjen Member Posts: 53
    txeriff wrote: »
    Hi,

    oh I see, xmlports on NAV 2009... I forgot about that..

    Are you sure the message is CONFIRM(Text003) what you are getting?

    i can recomend to add some traces to "debug" : Message(' pass');

    you can add different messages and see them to trace what code is doing.

    Try to MESSAGE(format(HideValidationDialog )) before all the IF updateline<>updateline::Update
    this way you will see if hidevalidationdialog has really true value.

    the other way is try convert it partially to dataport?

    Yes, I am sure the message is CONFIRM(Text003).
    Because if I set HideValidationDialog to true in table 357 document dimension right before my mod it doesn't display the message during my import, however, I don't want to set HideValidationDialog to true in that table. I should be able to set it from the xmlport.

    Since HideValidationDialog is not a field I can't use MESSAGE(format(HideValidationDialog ))

    I really appreciate your help! I am still trying I will find a solution
  • sjensjen Member Posts: 53
    I have tested it and it always set HideValidationDialog to false.
    in Document Dimension table the code I am trying to set HideValidationDialog to true is a local function called UpdateAllLineDim. Is it because of a local function that's why it never changes the value?
Sign In or Register to comment.