I have enabled change data capture for 5 fields in a table which is having 10 fields for Dynamics ax database
In those 5 fields i have modifiedBy field is available. So whenever i change a field in that 10 fields modifiedBy will be changing and its tracking it in CDC tables. But i dont want to track the changes in CDC tables if there is a change made in other 5 fields which are not tracked.
ex: Table1
A B C D E F G H I J(MODIFIEDBY)
1 2 3 4 5 6 7 8 9 10
8 6 4 3 2 4 5 6 7 8
I am tracking G,H,I,J,F. But J is modifiedBy field which changes everytime you make changes in any of nine fields. So if you make a change in field A , J will update so CDC capture the transaction. Which i dont want to track.
Can you please suggest me some solution for this. Thanks in advance.
The field ModifiedBy
is updated by the system each time a record is updated, irrespective which field is changed.
So you must either:
ModifiedBy
or:
SomeFieldsModifiedBy
The update of this field is trivial:
public void update()
{
if (this.G != this.orig().G || this.H != this.orig().H || ...)
this.SomeFieldsModifiedBy = curUserId();
super();
}
Also consider updating the field on insert.