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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Create Sales Order Line Charge Item via API

(0) ShareShare
ReportReport
Posted on by

I'm trying to create a Sales Order Line of type Charge via the API found here: https://docs.microsoft.com/en-us/dynamics-nav/fin-graph/api/dynamics_create_salesorderline

I've been able to create a normal Item by finding the Item Id here: https://api.businesscentral.dynamics.com/v1.0/[TENANT]/ODataV4/Company('CRONUS%20US')/nativeInvoicingItems

That list doesn't include any Charge Items. I was able to create a custom End Point over the Charge Item API and expose it. However there is no Id associated.

2_2D00_8_2D00_2019-12_2D00_25_2D00_40-PM.png

  • Suggested answer
    I Gusti Made Ari Profile Picture
    3,608 on at

    You can do following :

    1. Extend table 5800 Item Charge Table , add field "Id" type GUID .

      Add code at  OnAfterInsert trigger :

      Id := CreateGuid();

    2. Extend table 5476 "Sales Invoice Line Aggregate" , add field "Item Charge ID" Type GUID  . Onvalidate trigger of the field , put below code :

    VALIDATE(Type,Type::"Charge (Item)");

    ItemCharge.SETRANGE(Id,"Item Charge Id");

         IF NOT ItemCharge.FINDFIRST THEN

           EXIT;

         "No." := ItemCharge."No.";

    3. Pulled out this field "Item Charge ID" in to your API Page.

    4. In the request JSON , populate this "Item Charge ID"

  • aherrick Profile Picture
    on at

    Thanks for the response. Is there not a way to do this with base entities?

  • I Gusti Made Ari Profile Picture
    3,608 on at

    apparently no standard entity for item charge  , you need to create extension for this 

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans