FLS 为 Salesforce 对象创建

问题描述

有没有办法将 FLS 创建检查 - Schema.sObjectType.Account.fields.Name.isCreateable() 应用于以下内容?

public static Account createAccount() {
    return new Account(
        Name = 'Test',OwnerId = UserInfo.getUserId()
    );
}

想知道是否有一种无需重写以下内容即可申请的方法:

public static Account createAccount() {
    Account a = new Account();
    if (Schema.sObjectType.Account.fields.Name.isCreateable()) {
        a.Name = 'Test';
    }
    if (Schema.sObjectType.Account.fields.OwnerId.isCreateable()) {
        a.OwnerId = UserInfo.getUserId();
    }
    insert a;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)