Skip to Content

Duplicate Stock Transfer - DI API

Sep 04, 2017 at 08:34 PM


avatar image

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!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER 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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Diego, I apologize for the delay, thank you very much for your example, was exactly what I need.

Thank you again and best regards.

- Luis