• Beth Strella
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I want to create a field that has the last time the account was touched that was not done by a system admin.
By touch, I mean Newest date out of the following: Task Created date, Event created to date, task modified date, event modified date.
This trigger was built for us but doesn’t exclude the System admin as well as doesn’t give us the last day if they created an activity just gives us a modified date.  Not really sure how to fix it/ adjust it. Any help is appreciated. I have never used Apex before.
 
trigger UpdateLastActivityDate4318 on Task (after insert, after update, after delete, after undelete)
{
    Set<Id> accountIds = new Set<id>();
    if(Trigger.isDelete)
    {
        //always get the old for deleted activities
        for(Task t : Trigger.old)
        {
            accountIds.add(t.AccountId);
        }
    }
    else   
    {
        for(Task t : Trigger.new)
        {           
            accountIds.add(t.AccountId);
        }                  
       
    }
   
  List<Account> accounts =           
            [
                SELECT
                  Id,
                    (
                        SELECT
                          Subject,
                            LastModifiedDate
                        FROM Tasks
                        ORDER BY isClosed ASC, LastModifiedDate DESC
                        LIMIT 1
                    ),
                  Last_Activity_Date__c
                FROM Account
                WHERE Id in :accountIds
            ];
   
   
   
    for (Account a : accounts)
    {
   
        system.debug(a);
       
       
        if(a.Tasks.size() > 0)
        {
            system.debug(a.Tasks[0]);
            a.Last_Activity_Date__c = a.Tasks[0].LastModifiedDate;
        }
        else
        {
            a.Last_Activity_Date__c = null;
        }
    }
   
    update accounts;
}
 
}
 
 
 
User-added imageI can not seem to figure out how to get a profile to show up here. There doesn't seem to be a default profile under my profiles called external identity. How do I get a profile to appear here that way I can allow self-register 
I never got this message before. All of a sudden when the spring release hit the whole org is getting this message constently though out the day. It doesnt matter if they are just adding an account, contact. Updating an acitivity or contact. I can not even do an upload with data lister since i get a similar worded add when I try to use data loader. What is the issue and how can this be fixed?

The whole error reads:
"To protect all custemrs from excessive usage and denial of service attacks, we limit the number of long-running requests that are processed at the same time by an organization. Your Request has been denied becuase this limit has been exceeded by your organization. Please try your request again later."
I want to create a field that has the last time the account was touched that was not done by a system admin.
By touch, I mean Newest date out of the following: Task Created date, Event created to date, task modified date, event modified date.
This trigger was built for us but doesn’t exclude the System admin as well as doesn’t give us the last day if they created an activity just gives us a modified date.  Not really sure how to fix it/ adjust it. Any help is appreciated. I have never used Apex before.
 
trigger UpdateLastActivityDate4318 on Task (after insert, after update, after delete, after undelete)
{
    Set<Id> accountIds = new Set<id>();
    if(Trigger.isDelete)
    {
        //always get the old for deleted activities
        for(Task t : Trigger.old)
        {
            accountIds.add(t.AccountId);
        }
    }
    else   
    {
        for(Task t : Trigger.new)
        {           
            accountIds.add(t.AccountId);
        }                  
       
    }
   
  List<Account> accounts =           
            [
                SELECT
                  Id,
                    (
                        SELECT
                          Subject,
                            LastModifiedDate
                        FROM Tasks
                        ORDER BY isClosed ASC, LastModifiedDate DESC
                        LIMIT 1
                    ),
                  Last_Activity_Date__c
                FROM Account
                WHERE Id in :accountIds
            ];
   
   
   
    for (Account a : accounts)
    {
   
        system.debug(a);
       
       
        if(a.Tasks.size() > 0)
        {
            system.debug(a.Tasks[0]);
            a.Last_Activity_Date__c = a.Tasks[0].LastModifiedDate;
        }
        else
        {
            a.Last_Activity_Date__c = null;
        }
    }
   
    update accounts;
}
 
}
 
 
 
User-added imageI can not seem to figure out how to get a profile to show up here. There doesn't seem to be a default profile under my profiles called external identity. How do I get a profile to appear here that way I can allow self-register 
Is this possible? It seems out of the box not an option in the lighting New Event process.
  • November 16, 2015
  • Like
  • 0