Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Questions regarding posting a Vendor Invoice Credit Memo through AIF

(0) ShareShare
ReportReport
Posted on by

I have been tasked with creating a "Vendor Invoice Credit Memo" though a SOAP web service call to the AIF. I have been researching the task for a while but have been unable to figure this out. After my research I have some questions that I hope the community can help with!

1. A co-worker has told me that his understanding is that a credit memo for a vendor invoice would be entered as an Invoice Journal entry in AX. Is this correct? I have also heard that simply creating an invoice with a negative total balance (using a negative quantity) will do this. Can someone clarify the proper way that a credit memo would be posted to the Vendor in AX?

2. I have thoroughly reviewed the AOT in the developer workspace and I cannot find any services that work with the Vendor Invoice Journal. I have found a few queries that have been pre-loaded but I attempted to make a custom service with the "VendInvoiceJourJoinVendtrans" query that already exists, but I get errors that do not make sense when sending the requests to the service. Is there an endpoint for the Vendor Invoice Journal that I am not seeing? Or will this have to be a custom service that I build into the AOT?

Any help and direction for completing this task would be helpful as I have been struggling to find the correct answer by searching the internet. Thank you very much!

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    You're most welcome! Please mark the correct answer(s) as verified :)

    Have a great day yourself!

  • Community Member Profile Picture
    on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Hello,

    That did it. Thank you again for your quick and helpful responses. I truly appreciate it. Have a great day!

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Evan,

    Disable the inbound port,  Under Service contract customizations, click on "Customize documents" and click on "Data policies".

    Here you can enable all the required fields.

    Re-activate the service after you are done

  • Community Member Profile Picture
    on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Hello,

    I am wondering if something is incorrect my Dynamics AX setup. I followed the below steps to get the "LedgerGeneralJournalService" deployed:

    1. In AOT > ServiceGroups, I right-clicked "deploy service group" on "LedgerServices" group.

    2. In Inbound ports, I created the "AccountsPayableHTTPServices" port config, and in "Service Operations" I added the endpoints for the "LedgerGeneralJournalService" (create/read/find etc.)

    3. Clicked "Activate".

    When I then generate the WDSL from the URI and import to Visual Studio, my "AxdEntity_LedgerJournalTrans" object does not have the additional fields as I expected it should. Please see screenshot:

    entity_5F00_params.png

    Here you can see that the object "AxdEntity_LedgerJournalTrans" does not have the fields that are referenced in the example that you sent. Is there a reason why my objects in the WDSL are not containing the fields that are present in the example that you sent?

    I followed this same process when I worked on a normal vendor invoice and the objects in the WSDL had the fields defined as I expected on the C# objects that I used. I was able to successfully program that integration so that is where I got confused on this integration.

    Please let me know if there is something else that must be done in AX to have these fields be added to the WSDL file. That should solve my issue. Thank you again!

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Evan,

    Not sure where you are setting all the other necessary fields. Does the default dimension field have "company" values?

    Could you please try something simple like this?

    sites.google.com/.../howtocallaxaifservice-ccodeexampletocreategeneraljournalax2012

    Don't forget setting the JounalType on header to VendInvoiceRegister as well.

  • Community Member Profile Picture
    on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Hello,

    I am making a sample data set here:

    List headerTableFields = new List();
    
    headerTableFields.Add(new DataField("JournalName", "DP Journal"));
    headerTableFields.Add(new DataField("Company", "dat"));
    headerTableFields.Add(new DataField("OffsetCompany", "dat"));
    headerTableFields.Add(new DataField("JournalNum", "DAT-000002"));
    headerTableFields.Add(new DataField("Invoice", "INV-00001"));
    headerTableFields.Add(new DataField("LineNum", -1));
    headerTableFields.Add(new DataField("CurrencyCode", "USD"));
    headerTableFields.Add(new DataField("AmountCurCredit", 499.99));
    headerTableFields.Add(new DataField("AcknowledgementDate", new DateTime(2020, 09, 01)));
    headerTableFields.Add(new DataField("TransDate", new DateTime(2020, 09, 01)));
    headerTableFields.Add(new DataField("DocumentDate", new DateTime(2020, 09, 01)));
    headerTableFields.Add(new DataField("Due", new DateTime(2020, 09, 01)));
    
    IDataRecord headerDataRecord = new DataRecord(headerTableFields);
    
    IDataTable headerTable = new DataTable(new List() { headerDataRecord });

    I then convert this data set into an "AxdEntity_LedgerJournalTable" array as follows:

    var journalName = GetStringFieldFromRecord(headerTable.DataRecords[0], "JournalName");
    
    var fieldList = new List();
    
    for (var index = 1; index < headerTable.DataRecords[0].DataFields.Count; index  )
    {
      var dataField = new AxdType_DimensionAttributeValue()
      {
        Name = headerTable.DataRecords[0].DataFields[index].Name,
        Value = GetStringFieldFromRecord(headerTable.DataRecords[0],
                  headerTable.DataRecords[0].DataFields[index].Name)
      };
    
      fieldList.Add(dataField);
    }
    
    var fieldSet = new AxdType_DimensionAttributeValueSet()
    {
      Values = fieldList.ToArray()
    };
    
    var transaction = new AxdEntity_LedgerJournalTrans()
    {
      DefaultDimension = fieldSet
    };
    
    var vendInvoiceJournalTable = new AxdEntity_LedgerJournalTable()
    {
      JournalName = journalName,
      LedgerJournalTrans = new AxdEntity_LedgerJournalTrans[1] {transaction}
    };
    
    var vendInvoiceJournalArray = new AxdEntity_LedgerJournalTable[1]{vendInvoiceJournalTable};

    I then pass this object into the "GeneralJournalServiceClient.create" method.

    using (GeneralJournalServiceClient axInvoiceJournalClient = new GeneralJournalServiceClient())
    {
       var callContext = new CallContext()
       {
           Company = "DAT",
           LogonAsUser = logonUser,
           Language = "en-us"
       };
    
       axInvoiceJournalClient.create(callContext, vendInvoiceJournalArray);
    }

    This is when I get the error.

    LedgerServiceError.png

    Please let me know if you need any more information. I tried to simplify what I provided to make reading it easier. I can provide additional details if needed.

    Thank you very much!

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Evan, Could you please share your code?

  • Community Member Profile Picture
    on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Hello Gunjan,

    Thank you for the direction. I have updated my code to use LedgerGeneralJournalService. I have another issue though.

    I am attempting to "create" a ledger journal entry, and I am passing in "DefaultDimensions" for the fields in LedgerJournalTrans. I am passing in both "Company" and "OffsetCompany" fields, however I get an exception in AX that states:

    "Stack Trace: the company  does not exist."

    So I am passing in the company value but it says I am not. For reference, I have created entries in this table through the system without issue. I have records in LedgerJournalTrans with Company = "dat" and OffsetCompany = "dat". I tried passing these in through the "DefaultDimensions" of the service but get the above error.

    Can you assist with this issue as well?

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Questions regarding posting a Vendor Invoice Credit Memo through AIF

    Hi Evan,

    You can't use VendInvoiceJour and VendTrans, as records get inserted into these tables once the transaction is posted.

    You will need to use LedgerGeneralJournalService. Please check this post for a few workarounds to potential issues you might face -

    kimkopowski.blogspot.com/.../import-vendor-invoices-with-aif.html

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,978 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,821 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans