Activity Forums Salesforce® Discussions How to send an email notification to specific set of users when a Salesforce Visualforce Page gets updated?

  • Yogesh

    Member
    December 11, 2019 at 10:19 am

    Hello,

    ublic class CheckPageUpdates implements Schedulable {
    public void execute(SchedulableContext context) {
    LastTimeChecked__c check = LastTimeChecked__c.getOrgDefaults();
    if(check != null) {
    check = new LastTimeChecked__c(LastCheckedDateTime__c=DateTime.now());
    }
    ApexPage[] pagesModified = [SELECT Name FROM ApexPage WHERE LastModifiedDate <= :check.LastCheckedDateTime__c];
    if(!pagesModified.isEmpty()) {
    // Send an email or something here
    }
    check.LastCheckedDateTime__c = DateTime.now();
    upsert check;
    }
    You can schedule this for whatever frequency you like, such as hourly:

    System.schedule('MonitorVFChanges', '0 0 * * * ?', new CheckPageUpdates());

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos