如何解决Salesforce Apex - ObfuscateUser可从 Flow 调用 1 个用户 ID
我一直在努力,但没有成功(我是编码新手)。我正在尝试将此代码用于 obfuscateUser 并将其更新为以下内容:
非常感谢任何帮助!谢谢!!
public class UserManagementController{
public List <User> users {get; set;}
public UserManagementController()
{
Profile p = [select id from profile where name = 'Customer Community User'];
users = [select username, id from User where profileId=:p.id AND isactive=true];
}
//Use method with extreme caution. Data can't be recovered.
@invocableMethod(label='User Management' description='Obfuscate User data and more')
static public void obfuscate(List<User> users)
{
String uid = ApexPages.currentPage().getParameters().get('uid');
if(uid == null)
return;
User u = [select contactId from user where id=:uid];
System.UserManagement.obfuscateUser(uid);
if(u.contactId != null)
{
List <Contact> contacts = [select id from Contact where id=:u.contactId LIMIT 1];
if (contacts == null || contacts.isEmpty() == true)
return;
delete contacts;
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。