怎么取得所有Object的创建者,创建时间(使用SOQL实现)
2023年09月13日
文章浏览:350
需求: 有时候,我们需要把自定义Object的创建者,创建时间取出来

我们可以用下面的SOQL语句来取得(需要勾选上Use Tooling API?选项


取得单独一个Object的创建者和创建时间

SELECT CreatedById, CreatedBy.Name, DeveloperName,CreatedDate FROM CustomObject where DeveloperName ='Study'


如果要取得所有的自定义Object的创建者和创建时间

SELECT CreatedById, CreatedBy.Name, DeveloperName,CreatedDate  FROM CustomObject 


取得的结果如下

"_","CreatedById","CreatedBy","CreatedBy.Name","DeveloperName","CreatedDate"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","Study","2021-12-27T23:36:41.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","Salesforce","2022-01-12T06:01:40.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","Task","2022-01-24T09:07:05.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","Project","2022-02-08T05:35:44.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","Ticket","2022-02-08T05:36:05.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","ReportA","2022-03-30T11:08:08.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","ReportChild","2022-03-30T11:08:32.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","DrawingManagerCSVList","2022-10-06T12:01:51.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","DrawingManagerCSVList2","2022-10-06T12:18:41.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","ParentObject","2023-02-26T06:09:34.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","ChildObject","2023-02-26T06:10:04.000+0000"
"[CustomObject]","0055h000004YWm7AAG","[User]","兪 思忠","SlackMessage","2023-08-31T12:22:15.000+0000"



关于CustomObject ,详细可以参考下面的链接

 https://developer.salesforce.com/docs/atlas.ja-jp.api_meta.meta/api_meta/customobject.htm 



关注 收藏