Newer Version Available
Query the SourceMember Object to Get Change Information
The SourceMember object stores the state of changes to metadata source components. If
you're using a sandbox enabled for source tracking, you can query SourceMember to get information
about component changes.
For example, the ChangedBy field on SourceMember provides the ID of the User who made the last change to a component. To display a list of changed components with information about the user who made the most recent change, use a query similar to:
1sfdx force:data:soql:query -q "SELECT MemberName, MemberType, ChangedBy, RevisionCounter FROM SourceMember" -t -u MyDevSandboxWhere MyDevSandbox is the username or alias of the sandbox you're querying. The response gives you the ID of the User who last changed each component.
1MEMBERNAME MEMBERTYPE CHANGEDBY REVISIONCOUNTER
2─────────────────────────── ──────────── ─────────────── ──
3Account.MyTextField__c CustomField 0056g000000FDuZ 1
4Contact.MyField__c CustomField 0056g000000FDuZ 11
5Admin Profile 0051k000002KW4R 54
6MyObj1__c-MyObj1 Layout Layout 0051k000002KW4R 55
7Account-Account Layout Layout 0056g000000FDuZ 33
8Contact-Contact Layout Layout 0056g000000FDuZ 45
9MyObj1__c CustomObject 0051k000002KW4R 57
10TVRemoteControl ApexClass 0056g000000FDuZ 53Run another query to map IDs in the CHANGEDBY field to usernames.
1sfdx force:data:soql:query -q "SELECT Id,Username,Name FROM User" -u MyDevSandboxAnd the result is similar to:
1ID USERNAME NAME
2────────────────── ────────────────────────────────────── ──────
30051k000002KW4RAAW dev2@example.com.devsb1 Dev2
40056g000000FDuZAAW admin@example.com.devsb1 Admin User