Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

Posted on by 70

I have two BOMs, each with the same unit of measure. When I add a line to BOM1 of type Production BOM that reference BOM2, I get no errors. Where I'm seeing the issue is when I do this through the API, passing in Type as "Production BOM", returns the following error:

"Type must be equal to 'Item'  in Production BOM Line"

We are only using one unit of measure in our environment, I've seen that typically be an issue in the past, but I can't see that causing any problems here.

  • Connor Hyde Profile Picture
    Connor Hyde 70 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    I do think this is actually a [tag:bug], this will probably be my final update as I've been able to narrow down specifically what makes it work and break.

    1. Add BOM line of type 'Production BOM' in the BC interface, it will default the uom to whatever the BOM uom is

    2. Add BOM line of type 'Production BOM' through the API with said default value, it throws the type error - you cannot pass in any value for uom

    Furthermore, to reproduce the error in the UI, you can change the uom of a 'Production BOM' type line to anything other than the default value. This goes for both lines added manually and through the API.

  • MahGah Profile Picture
    MahGah 15,428 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    awesome. Thanks for sharing. This is really helpful

  • Connor Hyde Profile Picture
    Connor Hyde 70 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    Okay so this time I've really found the issue. BOM lines can't have a unit of measure associated with them if they are of type 'Production BOM'.

    Edit:

    Or maybe not, it seems they can have a default uom, will update when I figure out some more

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,428 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    That could be. I mean if it works for Prod BOM that has no similar item then that could be the issue. But if that is the issue it looks like the [tag:bug]  to me since it is a high chance any company has both of them at the same time and that should not cause an issue for API.

  • Connor Hyde Profile Picture
    Connor Hyde 70 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    I think I might have found the issue, we have a BOM with number 756926, but also an item with that same number. Could this be confusing the API? I was able to get a POST call working when I deleted the item record but kept the BOM.

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,428 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    That is strange, I mean looks like your API is correct. I usually see Line_No first (before anything else) but I do not think that cause this issue.

    I am not a developer. But maybe yzhums  is kind enough to provide some tips here.

  • Connor Hyde Profile Picture
    Connor Hyde 70 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    Hello,

    Thanks for the response, I'm not passing in any filters aside from the company id, and I have been passing in a UOM as well. I'll post some specific information on how I'm making the API call below. This is all done in a POST request, and I can actually use the same format for other bom numbers and get a successful result, which leads me to believe there is some business rule I'm not aware of that exists inside of BC causing this error:

    Request Body:

    {

    "Production_BOM_No":"756928",

    "Description":"BRACKET",

    "Unit_of_Measure_Code":"EACH",

    "Type":"Production BOM",

    "No":"756926",

    "Line_No":0,

    "Version_Code":"",

    "Quantity_per":1

    }

    Request URL:

    wiise.api.bc.dynamics.com/.../ProductionBOMLines?company={id}

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,428 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    Hi

    A few questions

    1) Do you have any filter on your API? Such as filter for Type = Item? If yes that could cause an issue

    2) I think with API and Production Order you need to pass UOM for Production BOM as well. Can you try that as well?

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    Hello,

    If you don't get further responses to this issue, you may want to raise a support request to Microsoft support via your CSP / Partner.

  • Connor Hyde Profile Picture
    Connor Hyde 70 on at
    RE: Trouble adding bom line of type "Production BOM": "Type must be equal to 'Item' in Production BOM Line"

    It also seems strange that I can make a PATCH request immediately after creating a line of type Item, changing only the type to Production BOM with no issue.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans