Skip to main content

Notifications

Business Central forum
Suggested answer

having problem inserting record to "sales job price list".

Posted on by 25

I am trying to insert new record to "sales job price lists" but not sure how to exactly do that :) i exposed three pages (7015 Sales price lists, 7016 sales price list, 7019 sales job price lists). i am able to insert new record to page 7015, but not sure how to set the type to :"job".

this is my request json:

 {     
            "AssignToParentNo""",
            "SourceNo""",
            "AssignToNo""",
            "VATBusPostingGrPrice""",
            "PriceIncludesVAT"false,
            "AmountType""Price & Discount",
            "Status""Draft",
            "CurrencyCode""",
            "StartingDate""0001-01-01",
            "EndingDate""0001-01-01",
            "AllowUpdatingDefaults"false,
            "AllowInvoiceDisc"false,
            "AllowLineDisc"false
        }
Url Odata: api.businesscentral.dynamics.com/.../SalesPricesList (this is the path of page 7015)
i would like to insert to page 7019, but it does not allow inserting..."
 "message""Entity does not support insert.  CorrelationId:  7fb19d8b-80a7-4725-95fd-9fba69d7ddbf."
if i request HTTP get, i get the list of job pricess, but post to this page is not allowed.
 
  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,217 Moderator on at
    RE: having problem inserting record to "sales job price list".

    hello

    I always recommend using a custom page api

    perhaps creating staging tables in which to check the data and in AL insert the record in a standard entity

    learn.microsoft.com/.../devenv-api-pagetype

    DAniele

  • Fisher A Profile Picture
    Fisher A 25 on at
    RE: having problem inserting record to "sales job price list".

    this is the PAth i request:

    api.businesscentral.dynamics.com/.../priceListHeaders

    Request json:

    {

               "description": "List",

               "status": "Draft",

               "sourceType": "All Jobs",

               "priceType": "Sale",

              "sourceGroup": "Job",

              "startingDate":"2022-11-01",

              "endingDate":"2022-11-02"

    }

    response:

    {

       "@odata.context": "api.businesscentral.dynamics.com/.../$metadata

       "@odata.etag": "W/\"JzE5OzExMzA0ODkyMTQzMzU4ODk4NTkxOzAwOyc=\"",

       "systemId": "764d7fc9-b385-ed11-9989-0022489ea374",

       "description": "List",

       "code": "J00032",

       "status": "Draft",

       "sourceType": "(All)",

       "priceType": "Any",

       "assignToNo": "",

       "assignToParentNo": "",

       "startingDate": "0001-01-01",

       "endingDate": "2022-11-02",

       "currencyCode": "",

       "sourceGroup": "Job"

    }

    as from response seen:

    1) sourceType is changed to ALL, though value was supplied "All Jobs"

    2) startingDate is set to "0001-01-01"

  • Fisher A Profile Picture
    Fisher A 25 on at
    RE: having problem inserting record to "sales job price list".

    Thank you! I will check the videos.

    For now,i came to TEMP solution that if i make POST request to insert new price list header - item is created and if later on i  make separate requests (patch) with supplying only startig_Date and on another request ending_Date, dates stays as expected. Problem happens if both dates are supplied in same request. Then just ending_date is set and starting_date is set to "0000-00-01".

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,510 Super User 2024 Season 2 on at
    RE: having problem inserting record to "sales job price list".

    Hi, I briefly checked the standard code and it doesn't look like this part is limited.

    pastedimage1672098690113v1.png

    pastedimage1672098703889v2.png

    You can add some behaviors that you want to attach in the trigger of the API page.

    Here is information from BC API expert AJ.

    https://www.youtube.com/watch?v=5iRv0y0rVzw&t=68s

    pastedimage1672098869575v3.png

    pastedimage1672098881576v4.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Fisher A Profile Picture
    Fisher A 25 on at
    RE: having problem inserting record to "sales job price list".

    Thank you! Api did the job and now i am able to insert records to the price list header table. Just couple of quiestions..

    1) on insert i am not able to supply the status value 'active'. It works just with the status value 'draft' and later i can patch/update this value to active. I guess thats how it works?

    2) i can set the value of ending_date but i can not set value for starting_date...there has to be some constraints that i can not figure out yet.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: having problem inserting record to "sales job price list".

    Hi,

    I would suggest go with Zhu, create new Page with the standard table and publish that page and consume it for inserting the data, as standard page can give your some limitations.

    Thanks.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,510 Super User 2024 Season 2 on at
    RE: having problem inserting record to "sales job price list".

    Hi, Personally, I don't recommend publishing standard pages to Web Service and then accessing them with Odata. This has many limitations and will have performance issues.

    You can create a new API page.

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-develop-custom-api

    Hope this helps.

    Thanks.

    ZHU

  • Fisher A Profile Picture
    Fisher A 25 on at
    RE: having problem inserting record to "sales job price list".

    Please, tell me more:) the worst thing that i lack finding good documentation...

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,744 Moderator on at
    RE: having problem inserting record to "sales job price list".

    You should look at these two fields:

    pastedimage1671983304970v1.png

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

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans