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:
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
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"
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".
Hi, I briefly checked the standard code and it doesn't look like this part is limited.
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
Hope this helps as well.
Thanks.
ZHU
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.
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.
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.
Hope this helps.
Thanks.
ZHU
Please, tell me more:) the worst thing that i lack finding good documentation...
You should look at these two fields:
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148