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

  1. //I used the code below...but change is always coming back null.
  2. Sage.Platform.ChangeManagement.IChangedState state = Account as Sage.Platform.ChangeManagement.IChangedState;
  3. Sage.Platform.ChangeManagement.EntityPropertyChange change = state.GetChangedState().FindMemberChange<Sage.Platform.ChangeManagement.EntityPropertyChange>("ExtensionTableName");
  4. if (change != null && change.OldEntity != null)
  5. {
  6. Sage.Entity.Interfaces.IExtensionTableName oldext = (Sage.Entity.Interfaces.IExtensionTableName)change.OldEntity.GetReferencedEntity();
  7. Sage.Entity.Interfaces.IExtensionTableName newext = (Sage.Entity.Interfaces.IExtensionTableName)change.NewEntity.GetReferencedEntity();
  8. if (oldext.PropertyName != newext.PropertyName)
  9. {
  10. //Process Data here
  11. }
  12. }
  13.  
  14. //Code below works...
  15. Sage.Platform.ChangeManagement.IChangedState state = Account as Sage.Platform.ChangeManagement.IChangedState;
  16. if (state != null)
  17. {
  18. Sage.Platform.ChangeManagement.ChangeSet changedState = state.GetChangedState();
  19. EntityChange changeext = changedState.FindMemberChange<EntityChange>("ExtensionTableName");
  20. if (changeext != null)
  21. {
  22. ChangeSet[] changeextmembers = changeext.GetChildChangeSets();
  23. foreach (ChangeSet member in changeextmembers)
  24. {
  25. Sage.Platform.ChangeManagement.PropertyChange prop = member.FindPropertyChange("PropertyName");
  26. if (prop != null)
  27. {
  28. //Process Data here
  29. }
  30. }
  31. }
  32. }
Posted in:

Start a Project With Us

Submit your email below to get in touch with our team.