I recently had to implement this change for a client that needed to track if a property on an extension table changed and apply a business rule based on the original and new value. My first response was yes, that can be easily done since SalesLogix has provided this functionality in the framework. It took a bit of digging around to get it working but I finally was able to implement it successfully. I have included 2 examples below for reference (the first one does not work). Code has only been tested in 7.5.1
//I used the code below...but change is always coming back null.
Sage.Platform.ChangeManagement.IChangedState state = Account as Sage.Platform.ChangeManagement.IChangedState;
Sage.Platform.ChangeManagement.EntityPropertyChange change = state.GetChangedState().FindMemberChange("ExtensionTableName");
if (change != null && change.OldEntity != null)
{
Sage.Entity.Interfaces.IExtensionTableName oldext = (Sage.Entity.Interfaces.IExtensionTableName)change.OldEntity.GetReferencedEntity();
Sage.Entity.Interfaces.IExtensionTableName newext = (Sage.Entity.Interfaces.IExtensionTableName)change.NewEntity.GetReferencedEntity();
if (oldext.PropertyName != newext.PropertyName)
{
//Process Data here
}
}
//Code below works...
Sage.Platform.ChangeManagement.IChangedState state = Account as Sage.Platform.ChangeManagement.IChangedState;
if (state != null)
{
Sage.Platform.ChangeManagement.ChangeSet changedState = state.GetChangedState();
EntityChange changeext = changedState.FindMemberChange("ExtensionTableName");
if (changeext != null)
{
ChangeSet[] changeextmembers = changeext.GetChildChangeSets();
foreach (ChangeSet member in changeextmembers)
{
Sage.Platform.ChangeManagement.PropertyChange prop = member.FindPropertyChange("PropertyName");
if (prop != null)
{
//Process Data here
}
}
}
}
Posted in: