February 9, 2021

getSobject of CreatedBy field Salesforce Apex

Sample code:

sObject obj = [ SELECT Id, CreatedBy.Alias, Name FROM Account LIMIT 1 ];
system.debug( obj.getSobject( 'CreatedBy' ).get( 'Alias' ) );


No comments:

Post a Comment