Search code examples
soapnavision

Microsoft Dynamics Nav Web Services - Assembly BOM


I'm trying to create an Integration with Microsoft Dynamics Nav and want to edit assembly BOM's of items. I'm able to read an assembly BOM item by searching the line items number and then parsing the record ID to give me the parent item Number. I now want to create an Assembly BOM, the SOAP web service has a create call but i'm unsure what to pass into the new line item to link it to a parent record.


Solution

  • The quickest way would be to create a new Page with Source Table BOM Component. All fields that you want to fill should also be in that Page. Then this Page should be Publish as new Web Service.

    In my Example the Name of the Web Service is AssemblyBOM. I changed the Example from the MSDN Articel Walkthrough: Registering and Using a Page Web Service (SOAP) to create to entries in the Assembly BOM:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using ConsoleApp1.AssemblyBOMWebService;
    
    namespace ConsoleApp1
    { 
        class Program
        {
            static void Main(string[] args)
            {
            AssemblyBOM_Service service = new AssemblyBOM_Service();
            service.UseDefaultCredentials = true;
    
            //First Item
            AssemblyBOM bom = new AssemblyBOM();
            bom.Parent_Item_No = "10000";
            bom.Line_No = 10000;
            bom.Type = AssemblyBOMWebService.Type.Item;
            bom.No = "10021";
    
            // Additional Fields ..  
    
            service.Create(ref bom);
    
            // Secord Item
            AssemblyBOM bom = new AssemblyBOM();
            bom.Parent_Item_No = "10000";
            bom.Line_No = 20000;
            bom.Type = AssemblyBOMWebService.Type.Item;
            bom.No = "10025";
    
            // Additional Fields ..  
    
            service.Create(ref bom);
    
            Console.WriteLine("Press [ENTER] to exit program!");
            Console.ReadLine();            }
        }
    }