Skip to Content

Duplicate Stock Transfer - DI API

Good day experts,

I am developing an application that converts stock transfer requests to stock transfers, only I came across one detail: at the moment of making that conversion and generating the stock transfer, the inventory is already affected , but I require a way to duplicate that last move to only edit the source and destination warehouse, and create an exact copy but with different warehouse, without requiring to redefine all lines from the beginning, this to automate a warehouse process.

I searched the forum and the web, but I do not find any way to achieve this, could someone confirm me if it's possible? If yes, could you provide me with an example or resource that can consult to get it?

Thank you in advance for your support, best regards!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Sep 05, 2017 at 02:27 PM

    Hi Luis,

    A full sample:

    StockTransfer oStTransfer = null;
        //Set up your company object to work with xml import/export.
        oCompany.XmlExportType = BoXmlExportTypes.xet_ExportImportMode;
        oCompany.XMLAsString = true;
        string xmlStockTransfer = string.Empty;
        //Load your last stock transfer.
        oStTransfer = oCompany.GetBusinessObject(BoObjectTypes.oStockTransfer);
        if (oStTransfer.GetByKey(9980))
            //Convert your strock transfer object in a xml
            xmlStockTransfer = oStTransfer.GetAsXML();
        if (!string.IsNullOrEmpty(xmlStockTransfer))
            //Intialize a new stock transfer through your xml
            oStTransfer = oCompany.GetBusinessObjectFromXML(xmlStockTransfer, 0);
            //Change the fields that you want.
            for (int i = 0; i < oStTransfer.Lines.Count; i++)
                oStTransfer.Lines.FromWarehouseCode = "014.01";
                oStTransfer.Lines.WarehouseCode = "001.01";
            //Add the new transfer.
            if (oStTransfer.Add() != 0)
    catch (Exception ex)

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.