WM-Synergy Business Objects SDK Information

WM-Synergy Business Objects SDK Information

WM-Synergy Business Objects

WM-Synergy Business Objects, SBO, is a comprehensive transaction library built on the both the .net standard and .net framework platforms.  This library allows the developer to quickly read/write/update transactional data with the Visual ERP database.
  1. Ensures that all tables required for a data transaction are properly updated.
  2. Synergy supports this product, if you find a bug, we will fix it at no cost to you.
  3. The code base allows you as a developer to write your own SQL code as needed.
  4. The code allows for roll back of transactions if a record does not complete properly.

The SBO installer package comes with sample programs on how to use the SynergyBusinessObjects.dll library.  
As Microsoft moves away from standard system libraries included with Windows, it becomes important to include in your developer project any and all libraries that are provided with this SDK kit. 
With updates for support of Visual 11 the SynergyBusinessObjects.dll relies on Oracle.ManagedDataAccess.dll, even if you are a Microsoft SQL only facility. 
Notes
The following libraries may also be required, in a customer created project:
  1. Microsoft.Bcl.AsynInterfaces.dll
  2. Oracle.ManagedDataAccess.dll
  3. System.Buffers.dll
  4. System.formats.Asn1.dll
  5. System.IO.Pipelines.dll
  6. System.Memory.dll
  7. System.Numerics.Vectors.dll
  8. System.Runtime.CompilerServices.Unsafe.dll
  9. Sytem.Text.Encodings.Web.dll
  10. System.Text.Json.dll
  11. System.Threading.Tasks.Extensions.dll
  12. System.Value.Tuple.dll

Starting with Visual 11 support for single site, Visual ERP 7 and below, is no longer supported or provided with sbo objects.  
We can provide a non-supported version SynergyBusinessObjects70.dll  (available upon request).

Connection Test

  1.     [TestClass]
  2.     public class ConnectionTest
  3.     {
  4.         #region Private Methods
  5.         /// <summary>
  6.         /// <c>GetSBOAuthenticator</c> url as specified in the app.config.
  7.         /// </summary>
  8.         /// <returns></returns>
  9.         private Uri GetSBOAuthenticator()
  10.         {
  11.             Uri Url = null;
  12.             SBOServer.AuthenticationService Svc = new SBOServer.AuthenticationService();

  13.             ConfigurationManager.AppSettings["SchemaPath"] = Environment.CurrentDirectory + "\\";
  14.             string SBOServer = ConfigurationManager.AppSettings["SBOServer"].ToString();
  15.             string SBOPort = ConfigurationManager.AppSettings["SBOPort"].ToString();

  16.             Url = new Uri(string.Format("http://{0}:{1}/AuthenticationService.asmx", SBOServer, SBOPort));

  17.             return Url;
  18.         }
  19.         /// <summary>
  20.         /// <c>ConnectToDbase</c> using the values set in the App.config file.
  21.         /// </summary>
  22.         /// <returns>Database connection</returns>
  23.         private Synergy.BusinessObjects.DatabaseConnection ConnectToDbase()
  24.         {
  25.             Uri Url = GetSBOAuthenticator();
  26.             Synergy.BusinessObjects.DatabaseConnection DataBase = new Synergy.BusinessObjects.DatabaseConnection(Url);
  27.             //Connection information
  28.             string DBType = ConfigurationManager.AppSettings["DBType"].ToString();
  29.             string DBServer = ConfigurationManager.AppSettings["DBServer"].ToString();
  30.             string DBDatabase = ConfigurationManager.AppSettings["DBDatabase"].ToString();
  31.             string DBUser = ConfigurationManager.AppSettings["DBUserId"].ToString();
  32.             string DBPassword = ConfigurationManager.AppSettings["DBPassword"].ToString();

  33.             DataBase.UserCredentials.UseBlind = true; //Default Value = true
  34.             DataBase.UserCredentials.DatabaseType = (DBType == "SqlServer" ? Synergy.BusinessObjects.DatabaseEngineType.SqlServer : Synergy.BusinessObjects.DatabaseEngineType.Oracle);
  35.             DataBase.UserCredentials.Server = DBServer; //Enter the Server (and instance name for SqlsErver)
  36.             DataBase.UserCredentials.Database = DBDatabase;
  37.             DataBase.UserCredentials.UserID = DBUser;
  38.             DataBase.UserCredentials.Password = DBPassword;

  39.             DataBase.Connect();

  40.             return DataBase;
  41.         }
  42.         #endregion
  43.         #region Unit Tests
  44.         [TestMethod]
  45.         public void AuthenticationTest()
  46.         {
  47.             Uri Url = null;
  48.             SBOServer.AuthenticationService Svc = new SBOServer.AuthenticationService();
  49.             try
  50.             {
  51.                 Url = GetSBOAuthenticator();
  52.                 Svc.Url = Url.ToString();
  53.                 Svc.AuthenticateNode("Test");
  54.                 Svc.Dispose();
  55.                 Assert.AreEqual(1, 1); // Success 
  56.             }
  57.             catch (Exception ex)
  58.             {
  59.                 Assert.Fail(ex.Message);
  60.             }
  61.         }

  62.         [TestMethod]
  63.         public void ConnectToDatabase()
  64.         {
  65.             try
  66.             {
  67.                 //Create the Database Connection – define the Connection Manager Server
  68.                 Synergy.BusinessObjects.DatabaseConnection Database = ConnectToDbase();
  69.                 if (Database.Connected)
  70.                 {
  71.                     Assert.IsTrue(1 == 1, "Database Connection is a Success!");
  72.                     Database.CloseConnection();
  73.                 }
  74.                 else
  75.                     Assert.Fail("Check the app.config settings.");
  76.             }
  77.             catch (Exception ex)
  78.             {
  79.                 Assert.Fail(ex.Message);
  80.             }
  81.         }
  82.         #endregion
  83.     }

Connect To Database

  1.  /// <summary>
  2.  /// <c>ConnectToDbase</c> using the values set in the App.config file.
  3.  /// </summary>
  4.  /// <returns>Database connection</returns>
  5.  private Synergy.BusinessObjects.DatabaseConnection ConnectToDbase()
  6.  {
  7.      Uri Url = GetSBOAuthenticator();
  8.      Synergy.BusinessObjects.DatabaseConnection DataBase = new Synergy.BusinessObjects.DatabaseConnection(Url);
  9.      //Connection information
  10.      string DBType = ConfigurationManager.AppSettings["DBType"].ToString();
  11.      string DBServer = ConfigurationManager.AppSettings["DBServer"].ToString();
  12.      string DBDatabase = ConfigurationManager.AppSettings["DBDatabase"].ToString();
  13.      string DBUser = ConfigurationManager.AppSettings["DBUserId"].ToString();
  14.      string DBPassword = ConfigurationManager.AppSettings["DBPassword"].ToString();

  15.      DataBase.UserCredentials.UseBlind = true; //Default Value = true
  16.      DataBase.UserCredentials.DatabaseType = (DBType == "SqlServer" ? Synergy.BusinessObjects.DatabaseEngineType.SqlServer : Synergy.BusinessObjects.DatabaseEngineType.Oracle);
  17.      DataBase.UserCredentials.Server = DBServer; //Enter the Server (and instance name for SqlsErver)
  18.      DataBase.UserCredentials.Database = DBDatabase;
  19.      DataBase.UserCredentials.UserID = DBUser;
  20.      DataBase.UserCredentials.Password = DBPassword;

  21.      DataBase.Connect();

  22.      return DataBase;
  23.  }

Run your own SQL Query

  1.  [TestMethod]
  2.  public void TestSQLCommand()
  3.  {
  4.      Synergy.BusinessObjects.DatabaseConnection Database = null;
  5.      try
  6.      {
  7.          Database = ConnectToDbase();
  8.          if (Database.Connected)
  9.          {
  10.              IDbCommand SQLCmd = Database.CreateNewCommand;
  11.              SQLCmd.CommandText = "SELECT COUNT(*) FROM PART";
  12.              object CmdReturn = SQLCmd.ExecuteScalar();      // Oracle returns a decimal, sql an int
  13.              if (CmdReturn != DBNull.Value)
  14.              {
  15.                  int PartCnt = 0;
  16.                  int.TryParse(CmdReturn.ToString(), out PartCnt);
  17.                  Assert.IsTrue(PartCnt > 0, "Fail, Perhaps you have no parts in dbo.PART?");
  18.              }
  19.              else
  20.                  Assert.Fail("Perhaps you have no Parts.");
  21.          }
  22.          else
  23.              Assert.Fail("Datbase Connection Failed, Check App.config");
  24.      }
  25.      catch (Exception ex)
  26.      {
  27.          Assert.Fail(ex.Message);
  28.      }
  29.      finally
  30.      {
  31.          if (Database != null) Database.Transaction = null;
  32.      }
  33.  }

Read Site Information

  1.    [TestMethod]
  2.    public void ReadSite()
  3.    {
  4.        Synergy.BusinessObjects.DatabaseConnection Database = null;
  5.        try
  6.        {
  7.            Database = ConnectToDbase();
  8.            if (Database.Connected)
  9.            {
  10.                Synergy.BusinessObjects.VE.SITE Site = new Synergy.BusinessObjects.VE.SITE(Database);
  11.                Site.ID = "%";
  12.                int Count = 0;
  13.                foreach (Synergy.BusinessObjects.VE.SITE Rec in Site.LoadLike(Site))
  14.                {
  15.                    Count += 1;
  16.                }
  17.                Assert.IsTrue(Count > 0, "Fail, did not find any Site records");
  18.            }
  19.            else
  20.                Assert.Fail("Datbase Connection Failed, Check App.config");
  21.        }
  22.        catch (Exception ex)
  23.        {
  24.            Assert.Fail(ex.Message);
  25.        }
  26.        finally
  27.        {
  28.            if (Database != null) Database.Transaction = null;
  29.        }
  30.    }

Read a Customer Record

In this sample the code will read all customer records.  Including the ones that are no longer active.
  1.   [TestMethod]
  2.   public void ReadCustomer()
  3.   {
  4.       Synergy.BusinessObjects.DatabaseConnection Database = null;
  5.       try
  6.       {
  7.           Database = ConnectToDbase();
  8.           if (Database.Connected)
  9.           {
  10.               Synergy.BusinessObjects.VE.CUSTOMER Customer = new Synergy.BusinessObjects.VE.CUSTOMER(Database);
  11.               Customer.ID = "%";
  12.               int Count = 0;
  13.               foreach (Synergy.BusinessObjects.VE.CUSTOMER Rec in Customer.LoadLike(Customer))
  14.               {
  15.                   Count += 1;
  16.               }
  17.               Assert.IsTrue(Count > 0, "Fail! Could not find any Customer records.");
  18.           }
  19.           else
  20.               Assert.Fail("Datbase Connection Failed, Check App.config");
  21.       }
  22.       catch (Exception ex)
  23.       {
  24.           Assert.Fail(ex.Message);
  25.       }
  26.       finally
  27.       {
  28.           if (Database != null) Database.Transaction = null;
  29.       }

  30.   }

Read Application Global

  1.   [TestMethod]
  2.   public void ReadApplication_Global()
  3.   {
  4.       Synergy.BusinessObjects.DatabaseConnection Database = null;
  5.       try
  6.       {
  7.           Database = ConnectToDbase();
  8.           if (Database.Connected)
  9.           {
  10.               APPLICATION_GLOBAL AppGlobal = new APPLICATION_GLOBAL(Database);
  11.               AppGlobal = AppGlobal.Load(1);

  12.               Assert.IsTrue(!string.IsNullOrEmpty(AppGlobal.COMPANY_NAME), "Fail!  Check app global for a company name");
  13.           }
  14.           else
  15.               Assert.Fail("Datbase Connection Failed, Check App.config");
  16.       }
  17.       catch (Exception ex)
  18.       {
  19.           Assert.Fail(ex.Message);
  20.       }
  21.       finally
  22.       {
  23.           if (Database != null) Database.Transaction = null;
  24.       }
  25.   }

Create a Customer Order

  1.  [TestMethod]
  2.  public void CreateCustomerOrder()
  3.  {
  4.      Synergy.BusinessObjects.DatabaseConnection Database = null;
  5.      try
  6.      {
  7.          Database = ConnectToDbase();
  8.          if (Database.Connected)
  9.          {
  10.              CUSTOMER_ORDER CustOrd = new CUSTOMER_ORDER(Database)
  11.              {
  12.                  SITE_ID = "101AMC",
  13.                  CUSTOMER_ID = "C-00001",
  14.                  STATUS = "R" //release it so we can ship it below.
  15.              };
  16.              CustOrd.Save();                   //Save it and you get the auto-generated ID
  17.              Assert.IsTrue(!string.IsNullOrEmpty(CustOrd.ID), "Fail!  Did not create an order for customer 'C-00001'");
  18.          }
  19.          else
  20.              Assert.Fail("Datbase Connection Failed, Check App.config");
  21.      }
  22.      catch (Exception ex)
  23.      {
  24.          Assert.Fail(ex.Message);
  25.      }
  26.      finally
  27.      {
  28.          if (Database != null) Database.Transaction = null;
  29.      }
  30.  }

Create a Voucher

There is a sample program, StarterMultiSite, that includes, or may be similar to,  the following code:

  1.    PAYABLE Voucher = new PAYABLE(_Database);
  2.    Voucher.SITE_ID = txtSiteId.Text;
  3.    Voucher.INVOICE_ID = txtInvoiceId.Text;
  4.    Voucher.VENDOR_ID = txtVendorId.Text;
  5.    Voucher.INVOICE_DATE = dtInvoiceDate.Value;
  6.    Voucher.TOTAL_AMOUNT = Convert.ToDecimal(txtTotalAmount.Text);

  7.    //   Voucher.POSTING_DATE = dtPostingDate.Value;       // This should be set at time of posting

  8.    PAYABLE_LINE Line = new PAYABLE_LINE(_Database);
  9.    Line.PURC_ORDER_ID = txtPOrder.Text; ;
  10.    Line.PURC_ORDER_LINE_NO = Convert.ToDecimal(txtLineNmbr.Text);
  11.    Line.QTY = Convert.ToDecimal(txtLineQty.Text);
  12.    Line.PO_UNIT_PRICE = Convert.ToDecimal(txtPOUnitPrice.Text);
  13.    Line.AMOUNT = Convert.ToDecimal(txtPOUnitPrice.Text) * Line.QTY;        // Calculate the total line amount

  14.    Line.RECEIVER_ID = txtReceiverId.Text;
  15.    Line.RECEIVER_LINE_NO = Convert.ToDecimal(txtReceiverLine.Text);
  16.    // Line.GL_ACCOUNT_ID = 

  17.    Voucher.Lines.Add(Line);
  18.    Voucher.Save();

  19.    MessageBox.Show(this, "Voucher Created", "Create Voucher", MessageBoxButtons.OK);

Create Customer Order with a Work Order

There is a sample program, StarterMultiSite, that includes, or may be similar to,  the following code:
  1.             using (new HourGlass())
  2.             {
  3.                 try
  4.                 {
  5.                     // Create a Customer Order
  6.                     CUSTOMER_ORDER co = new CUSTOMER_ORDER(_Database)
  7.                     {
  8. #if MultiSite
  9.                         SITE_ID = "MMC",
  10. #endif
  11.                         CUSTOMER_ID = "FINMAN",
  12.                         STATUS = "R" //release it so we can ship it below.
  13.                     };
  14.                     co.Save();                   //Save it and you get the auto-generated ID

  15.                     txtCustOrderId.Text = co.ID;
  16.                     txtCustOrderToShip.Text = co.ID;

  17.                     //Create an Order Line
  18.                     CUST_ORDER_LINE col = new CUST_ORDER_LINE(co)
  19.                     {
  20. #if MultiSite
  21.                         SITE_ID = co.SITE_ID,
  22. #endif
  23.                         PART_ID = "PRODUCT_P",
  24.                         USER_ORDER_QTY = 3,
  25.                         SELLING_UM = "EA"
  26.                     };
  27.                     col.Save();

  28.                     CUSTOMER_ORDER co1 = co.Load(co.ID);
  29.                     int foo = co1.Lines.Count;

  30.                     CUSTOMER_ORDER coLoader = new CUSTOMER_ORDER(_Database) { ID = "0200%" };
  31.                     List<CUSTOMER_ORDER> CoList = co.LoadLike(coLoader);
  32.                     foreach (CUSTOMER_ORDER c in CoList)
  33.                     {
  34.                         int foo2 = c.Lines.Count;
  35.                     }

  36.                     //Create a Work Order with an operation and a material 
  37.                     WORK_ORDER wo = new WORK_ORDER(_Database)
  38.                     {
  39. #if MultiSite
  40.                         SITE_ID = "MMC",
  41. #endif
  42.                         TYPE = "W",
  43.                         //wo.BASE_ID = "00_SS1"; //Don't set for auto number gen - NEXT_NUMBER_GEN table
  44.                         LOT_ID = "0",
  45.                         SPLIT_ID = "0",
  46.                         SUB_ID = "0",
  47.                         PART_ID = col.PART_ID
  48.                     };
  49.                     wo.DESIRED_QTY = wo.DESIRED_QTY;
  50.                     //wo.Save();

  51.                     //Create an operation on the WO
  52.                     OPERATION op = new OPERATION(wo)
  53.                     {
  54. #if MultiSite
  55.                         SITE_ID = wo.SITE_ID,
  56. #endif
  57.                         SEQUENCE_NO = 10,
  58.                         RESOURCE_ID = "DRILL"
  59.                     };
  60.                     //op.Save();
  61.                     wo.OPERATIONS.Add(op);

  62.                     //Add a material to the OPERATION
  63.                     REQUIREMENT req = new REQUIREMENT(op)
  64.                     {
  65. #if MultiSite
  66.                         SITE_ID = op.SITE_ID,
  67. #endif
  68.                         PART_ID = "1/4plate"
  69.                     };
  70.                     //req.Save();
  71.                     op.REQUIREMENTS.Add(req);

  72.                     wo.Save();

  73.                     txtWorkOrderId.Text = wo.BASE_ID;

  74.                     //
  75.                     //Connect the Demand fron the CO Line to the Supply from the WO
  76.                     //
  77.                     DEMAND_SUPPLY_LINK dsl = new DEMAND_SUPPLY_LINK(_Database)
  78.                     {
  79.                         SUPPLY_TYPE = "WO",
  80. #if MultiSite
  81.                         SUPPLY_SITE_ID = wo.SITE_ID,
  82. #endif
  83.                         SUPPLY_BASE_ID = wo.BASE_ID,
  84.                         SUPPLY_LOT_ID = wo.LOT_ID,
  85.                         SUPPLY_SPLIT_ID = wo.SPLIT_ID,
  86.                         SUPPLY_SUB_ID = wo.SUB_ID,

  87.                         DEMAND_TYPE = "CO",
  88. #if MultiSite
  89.                         DEMAND_SITE_ID = co.SITE_ID,
  90. #endif
  91.                         DEMAND_BASE_ID = co.ID,
  92.                         DEMAND_SEQ_NO = col.LINE_NO,
  93.                         ALLOCATED_QTY = wo.DESIRED_QTY
  94.                     };

  95.                     dsl.Save();                          //Save and the link is made
  96.                 }
  97.                 catch (Exception ex)
  98.                 {
  99.                     MessageBox.Show(ex.ToString());
  100.                 }
  101.             }

Delete a Packlist with SBO

The following code snippet demonstrates how to delete a Shipper, (Pack list), from the Infor Visual ERP database.
  1.  public bool Delete_Packlist(string packlist_id)
  2.         {
  3.             DatabaseConnection _Database;
  4.             bool result = true;
  5.             try
  6.             {
  7.                 // Add DB connection specific code here.

  8.                 using (IDbConnection conn = _Database.Connection)
  9.                 {
  10.                     conn.Open();
  11.                     SHIPPER s = new SHIPPER(_Database).Load(packlist_id);
  12.                     s.Delete();
  13.                     s.Save();
  14.                 }
  15.             }
  16.             catch (Exception ex)
  17.             {
  18.                 _Database.Transaction?.Rollback();
  19.                 result = false;
  20.             }
  21.             finally
  22.             {
  23.                 _Database.Transaction?.Dispose();
  24.                 _Database.Transaction = null;
  25.             }

  26.             return result;
  27.         }
    • Related Articles

    • WM-Synergy SBO - Release Notes

      v1100.1003 - 06/11/2025 Fix Issue in ShipperLine Customer Order for Part id 500pcs, WorkOrder to make part id is for 1000pcs. Linked CO to WO for Supply links for the 500 pcs. Ship the 500 pcs from sbo objects, expectations are (Visual ERP) customer ...
    • Retrieving Customizable User Defined Field (CUDF) List Values with SBO

      The UFD List data is stored in the USER_DEF_FIELDS table. It looks like this: You can retrieve it with a direct SQL query, but you need to know the UDF’s ID for the field in question. Here is an example: SELECT PROGRAM_ID, ID, DOCUMENT_ID, LINE_NO, ...
    • WM-Synergy Macro Editor

      WM-Synergy Macro Editor This is rich client user interface, which allows for the maintenance of Synergy Created Macros that support the Infor Visual ERP Manufacturing, (VE), Visual Basic Scripts (VBScript) typically used in a VE Macro situation. Each ...
    • Synergy Tax Version info

      To Find the version of Synergy Tax. Launch Visual Manufacturing Navigate to Sales > Customer Maintenance > Macros Menu >Tax Configuration The bottom of the Tax Configuration Screen will have the version number.
    • Synergy/Avalara Tax - Release Notes

      v1100.1003 2025.05.11 Add more diagnostic to validate the shipping address sent mod to SRI Macros SRITAX/SRITAXC to better handle an empty Avalara return data packet Add <line1><line2><line3> to the request packet information for traceability in ...