web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Create a payment through page service in NAV 2013 R2

(0) ShareShare
ReportReport
Posted on by 145

I am trying to integrate my system with the NAV to read the vendor ledger entries for invoices and process the payment outside the NAV. The problem that i am facing  is, after reading the invoices from ledger entries table and making the payments against those invoices through my system, i want to update the payment details back to the NAV which I coudn't identify a way so far. So to summarize, i am looking a way to update the payment information in NAV, possibly through API(page web services) or by any means. I have got a vague idea, that it has to be through the payment journals but i am not very sure. Any help on this matter is much appreciated.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Daniele Rebussi Profile Picture
    2,480 on at

    I think you can refer to this post which fullfill the same requirement. dynamicsuser.net/.../34440.aspx

  • Deepak Nair Profile Picture
    145 on at

    Thanks for the reply, Daniele.

    I had already seen the referred post and it wasn't helpful. It is only about creating filters for retrieving payment jounrals, where as i am looking for creating payments.

    Consider if i am creating payment journal through page service, what would be the next step towards posting that payment journal. How can we post a payment journal through service similar to manual process.

  • Daniele Rebussi Profile Picture
    2,480 on at

    Hi, if also the posting has to be done via web service, I suggest to use a different approach and develop a new codeunit to be exposed as WS.

    A function called by your system, accepting all the necessary parameters, will perform:

    - Insert of a record in Gen. Journal Line table (this method allows you also to do additional checks on value accuracy).

    - Call of Gen. Jnl.-Post Batch codeunit to post the line .

  • Deepak Nair Profile Picture
    145 on at

    Hi Daniele, i think i am kind of reaching close to the solution, need few more clarifications from your side.

    As you have suggested to use code unit service for inserting Journal Line and to post the line, I am seeing two code  units already available with the demo version which are

    1.Gen. Jnl.-Post Line

    2.Gen. Jnl.-Post Batch

    So, can i use these code units to post the line and the batch ?

  • Suggested answer
    Daniele Rebussi Profile Picture
    2,480 on at

    Yes, it's possible to use Gen. Jnl.-Post Line codeunit (sorry, I meant this one in my previous post) to post the line, but you cannot expose this codeunit as web service since it receives a record variable as parameter and this is not a type of interface allowed.

    Anyway as said before you can include a call to this codeunit inside a "wrapping" object which can be used by an external systems.

  • Deepak Nair Profile Picture
    145 on at

    So you mean by "wrapping" object, is to create a code unit accepting all the parameters for inserting a payment journal through the Gen. Jnl.-Post Line CU and once the line is created, then call the Gen. Jnl.-Post Batch CU to post the journal line entry.

    Please let me know if my understanding is correct.

    If this is the case, which are the functions that has to be called from the respective code units to Insert as well as posting the line.

    Appreciate your patience in answering my questions.

  • Verified answer
    Daniele Rebussi Profile Picture
    2,480 on at

    You just have to call the codeunit passing the journal record filled with the payment data. Here's a very rough example:

    OBJECT Codeunit 50000 VendorPaymentWS

    {

     OBJECT-PROPERTIES

     {

       Date=04/28/14;

       Time=[ 3:46:13 PM];

       Modified=Yes;

       Version List=;

     }

     PROPERTIES

     {

       OnRun=BEGIN

             END;

     }

     CODE

     {

       PROCEDURE CreateAndPostPayment@1000000000(pVendorNo@1000000000 : Code[20];pPaymAmount@1000000001 : Decimal;pPostingDate@1000000002 : Date;pDocNo@1000000003 : Code[20];pApplToDocType@1000000007 : ' ,Payment,Invoice,Credit Memo,Finance Charge Memo,Reminder,Refund';pApplToDocNo@1000000008 : Code[20]);

       VAR

         GenJnlLine@1000000004 : Record 81;

         LineNo@1000000005 : Integer;

         GenJnlPostLine@1000000006 : Codeunit 12;

       BEGIN

         GenJnlLine.SETRANGE("Journal Template Name",'PAYMENT');

         GenJnlLine.SETRANGE("Journal Batch Name",'GENERAL');

         IF GenJnlLine.FINDLAST THEN

           LineNo := GenJnlLine."Line No." + 10000

         ELSE

           LineNo := 10000;

         GenJnlLine.INIT;

         GenJnlLine."Journal Template Name" := 'PAYMENT';  //Fill with journal used for payments

         GenJnlLine."Journal Batch Name" := 'GENERAL';  //Fill with journal used for payments

         GenJnlLine."Line No." := LineNo;

         GenJnlLine.VALIDATE("Account Type",GenJnlLine."Account Type"::Vendor);

         GenJnlLine.VALIDATE("Account No.",pVendorNo);

         GenJnlLine.VALIDATE(Amount,pPaymAmount);

         GenJnlLine.VALIDATE("Posting Date",pPostingDate);

         GenJnlLine.VALIDATE("Document No.",pDocNo);

         GenJnlLine.VALIDATE("Bal. Account Type",GenJnlLine."Bal. Account Type"::"Bank Account");  //Fill an appropriate bal. account

         GenJnlLine.VALIDATE("Bal. Account No.",'001');  //Fill an appropriate bal. account

         GenJnlLine.VALIDATE("Applies-to Doc. Type",pApplToDocType);

         GenJnlLine.VALIDATE("Applies-to Doc. No.",pApplToDocNo);

         GenJnlLine.INSERT;

         GenJnlPostLine.RUN(GenJnlLine);

       END;

       BEGIN

       END.

     }

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans