Description
You can use the change log to gain an overview of changes in most windows of SAP Business One. Each time you update, for example, tax groups, withholding tax, house banks, freight, credit card, authorizations, sales, purchasing documents, production orders, charts of accounts, or UDOs, you can use the ChangeLogsService service to look up the change logs and show the differences between two change logs.
Source table: OGCL.
Object Model
Remarks
Example
Getting Change Log and Showing Differences between 2 Change Log Instances (C#) | ![]() |
---|
// This sample shows how to use the change log service
// We will get the change log of business partner with BP Code "BPID01"
// We will show the differences between 2 ChangeLog instances
ChangeLogsService cl = (ChangeLogsService)vCompSvr.GetBusinessService(SAPbobsCOM.ServiceTypes.ChangeLogsService);
GetChangeLogParams GetChLgParam = (GetChangeLogParams)cl.GetDataInterface(ChangeLogsServiceDataInterfaces.clsGetChangeLogParams);
ChangeLogsParams ChLgParams;
GetChLgParam.Object = BoChangeLogEnum.clCards; //BusinessPartners
GetChLgParam.PrimaryKey = "BPID01"; // Card Code
// Get Change Log
ChLgParams = cl.GetChangeLog(GetChLgParam);
// Show the first 2 changes
// Change Instance 1
MessageBox.Show("Instance 1: " + ChLgParams.Item(0).LogInstance +
", Object Code: " + ChLgParams.Item(0).ObjectCode +
", Update Date: " + ChLgParams.Item(0).UpdatedDate +
", User Name: " + ChLgParams.Item(0).UserName);
// Change Instance 2
MessageBox.Show("Instance 2: " + ChLgParams.Item(1).LogInstance +
", Object Code: " + ChLgParams.Item(1).ObjectCode +
", Update Date: " + ChLgParams.Item(1).UpdatedDate +
", User Name: " + ChLgParams.Item(1).UserName);
// Show the differences between the instances
ShowDifferenceParams param = (ShowDifferenceParams)cl.GetDataInterface(ChangeLogsServiceDataInterfaces.clsShowDifferenceParams);
param.Object = BoChangeLogEnum.clCards; // BusinessPartners
param.PrimaryKey = "BPID01"; // Card Code
// We will get the differences of these 2 instances
param.LogInstance = 1;
param.LogInstance2 = 2;
ChangeLogDifferencesParams retparams = null;
// Get differences
retparams = cl.GetChangeLogDifferences(param);
// Show the differences
for (int i = 0; i < retparams.Count; i++)
{
MessageBox.Show("User Name: " + retparams.Item(i).UserName +
", Date: " + retparams.Item(i).Date +
", Changed Field: " + retparams.Item(i).ChangedField +
", New Value: " + retparams.Item(i).NewValue +
", Old Value: " + retparams.Item(i).OldValue +
", Line Number: " + retparams.Item(i).LineNumber +
", Array Offset: " + retparams.Item(i).ArrayOffset);
} |
|
See Also
Get Change Log Params ObjectHolds the key to an existing change log.
This object is used to pass keys to and retrieve keys from the ChangeLogsService methods.
Parent: Change Logs Service ChangeLogsService Service· Table: OGCL
Show Difference Params ObjectHolds the key to an existing change log that contains several log instances.
This object is used to pass keys to and retrieve keys from the ChangeLogsService methods.
Parent: Change Logs Service ChangeLogsService Service· Table: OGCL
Change Logs Service Data Interfaces EnumerationChangeLogsService data interfaces.
Parent: Change Logs Service ChangeLogsService Service· Table: OGCL
Change Log Differences Params CollectionA collection of ChangeLogDifferencesParam objects.
Parent: Change Logs Service ChangeLogsService Service· Table: OGCL
Change Logs Params CollectionA collection of ChangeLogParams objects.
Parent: Change Logs Service ChangeLogsService Service· Table: OGCL