Can't create another record without refresh page

makaramakara Member Posts: 25
edited 2014-07-26 in NAV Three Tier
Dear All,

I am facing a problem in duplication on primary key. Scenario is like below.
I am creating a new customize table 'Payment detail'. on Service Order, user require to click on Payment to open 'Payment Detail' page. Primary key of 'Payment Detail' table was used No. Series.

when user open 'Payment Detail' page, system will insert new row to 'Payment Detail', if no record, which related to that document, found. else System just retrieve data and show in "Payment Detail" page.

when I choose Service Order with no record of 'Payment Detail' on first time, there is no error.
But when I choose another Service Order with no record of 'Payment Detail'. I got error (Please see attachment file).

That error won't occur, if I click on REFRESH button before choose another Service Order with no record of 'Payment Detail'.

Any advice for this problem?
Thanks in advance,
Makara

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Can you show us the Code under Payment Actions also logic code to insert/retrieve data..
  • makaramakara Member Posts: 25
    Below is the code, I wrote when my page open :
    IF DocType = DocType::Order THEN
       CheckDocType := CheckDocType::"Service Order"
    ELSE IF DocType = DocType::Invoice THEN
       CheckDocType := CheckDocType::"Service Invoice";
    
    GetDefaultValue(ResponCenters,PaymentMethodCodes,Dimension1,TerminalID,PaymentMethodCode,CardNo,CardIssuBank);
    
    Customer.RESET;
    Customer.SETRANGE("No.",CustNo);
    IF Customer.FIND('-') THEN BEGIN
       IF Customer."Paid on Post" =Customer."Paid on Post"::"1" THEN BEGIN
          PaymentDetail.RESET;
          PaymentDetail.SETRANGE("Document Type",CheckDocType);
          PaymentDetail.SETRANGE("Doc. No.",DocNo);
          IF PaymentDetail.FIND('-') = FALSE THEN BEGIN
              PaymentDetail.INIT;
              PaymentDetail."Document Type" := CheckDocType;
              PaymentDetail."Doc. No." := DocNo;
              PaymentDetail."Global Dimension 1 Code" := Dimension1;
              PaymentDetail."Terminal ID" := TerminalID;
              PaymentDetail."Tender Type" := PaymentMethodCode;
              PaymentDetail."Card No." := CardNo;
              PaymentDetail."Card Issuing Bank" :=CardIssuBank;
              PaymentDetail."User ID" := USERID;
              PaymentDetail."Entry Post Date" :=TODAY;
              PaymentDetail.Status := PaymentDetail.Status::Open;
              PaymentDetail.INSERT(TRUE);
          END;
          PAGE.RUN(50000,PaymentDetail);
       END;
    END;
    
Sign In or Register to comment.