在salesforce

时间:2015-05-09 10:29:05

标签: salesforce

我想每次在10个特定用户的salesforce中自动重置密码。为此,我在salesforce中编写了一个Apex类。我也想安排这门课程。但我是Apex编码的新手。

这是我写的课程:

public class DataTeam_ResetPassword
{

public DataTeam_ResetPassword()
{

    List<id> DteamIDs = new List<id>{'005A0000003ja3x'};


    for(Id u : DteamIDs)
    {
        system.setPassword(u,'qweEfetividade_1');
        system.setPassword(u,'werwEfetividade_1');
        system.setPassword(u,'wetEfetividade_1');
        system.setPassword(u,'dsfEfetividade_1');
        system.setPassword(u,'bhcvEfetividade_1');
        system.setPassword(u,'dhEfetividade_1');
        system.setPassword(u,'fjfjEfetividade_1');
        system.setPassword(u,'tyEfetividade_1');
        system.setPassword(u,'tweEfetividade_1');
        system.setPassword(u,'mmEfetividade_1');
        system.setPassword(u,'rwrEfetividade_1');
        system.setPassword(u,'jkgkEfetividade_1');
        system.setPassword(u,'5y4yEfetividade_1');
        system.setPassword(u,'kjEfetividade_1');
        system.setPassword(u,'asgaghEfetividade_1');
        system.setPassword(u,'Efafwrwrw_1');
      }
  }           
}

任何人都可以帮助我接下来需要做什么吗?

1 个答案:

答案 0 :(得分:0)

通过为所有必需用户提供公共配置文件,然后为该配置文件设置特定密码策略,您可能是更好的服务器。见Set Session Timeout and Password Policies for Individual Profiles

创建Apex Scheduler并使用System.resetPassword(ID userID, Boolean send_user_email)

global class scheduledPasswordReset implements Schedulable {
    global void execute(SchedulableContext SC) {
        Boolean sendUserEmail = true;
        System.resetPassword('005A0000003ja3x', sendUserEmail);
        // Repeat for other User Ids to reset.
    }
}

从以下内容开始:

scheduledPasswordReset m = new scheduledPasswordReset();
String sch = '20 30 8 10 2 ?';
String jobID = system.schedule('Reset Password Job', sch, m);

更改上面的expression以根据需要运行。