Hello, I am facing issue with creating child matr...
# suitetalkapi
r
Hello, I am facing issue with creating child matrix item using soap web services. Can you please guide me? Here is the sample code that we are using to create child matrix item. InventoryItem createInventoryItem = new InventoryItem(); //createInventoryItem.matrixType = ItemMatrixType._parent; createInventoryItem.matrixType = ItemMatrixType._child; createInventoryItem.matrixTypeSpecified = true; createInventoryItem.itemId = “TEST-CHILD-MATRIX”; createInventoryItem.upcCode = “66666666"; createInventoryItem.displayName = “Test Child Matrix Item”; createInventoryItem.vendorName = “Test child Matrix Vendor”; createInventoryItem.externalId = “666666”; // creating Cogs Account RecordRef cogsAccount = new RecordRef(); cogsAccount.internalId = “155"; cogsAccount.type = RecordType.account; cogsAccount.typeSpecified = true; createInventoryItem.cogsAccount = cogsAccount; // Creating Asset Account RecordRef assetAccount = new RecordRef(); assetAccount.internalId = “140”; assetAccount.type = RecordType.account; assetAccount.typeSpecified = true; createInventoryItem.assetAccount = assetAccount; ////tax Schedule RecordRef taxschedule = new RecordRef(); taxschedule.internalId = “1"; taxschedule.type = RecordType.taxType; taxschedule.typeSpecified = true; createInventoryItem.taxSchedule = taxschedule; RecordRef subItems = new RecordRef(); subItems.internalId = “5099”; subItems.externalId = “888888"; subItems.type = RecordType.inventoryItem; subItems.typeSpecified = true; createInventoryItem.parent = subItems; WriteResponse res = NSService.upsert(createInventoryItem);
doesnt look like you are setting the matrixOptionList
i would also be weary of using upsert, i dont think you can update an item to be a matrix child, only add
r
@battk tried with add also, but no success
b
and the matrixOptionList?
r
did it? same issue
b
you may want to try creating the matrix item you want in the ui, load it via suitetalk, then start copying the fields you need from it
you should only need to follow the documented steps from the help