2

I need to populate a date on the case object that has the Last Activity date recorded. I tried to make a date formula on the case object, but cannot find the LastActivity API to pull it through. Is there another work around I need to do in order to get this date moved to the case?

0

Here are some threads on the topic. Options are custom Trigger code, Custom Process Builder "flow" which has to use an Invokable class method to update the Case, or the Rollup helper app from the app exchange which could rollup the latest activity Created Date for example to a field on the Case.

https://developer.salesforce.com/forums/?id=906F0000000AUacIAG

https://success.salesforce.com/answers?id=90630000000hJAkAAM

| improve this answer | |
0

Please promote this idea https://success.salesforce.com/ideaView?id=08730000000ZeK2AAK

Create a trigger on Task to update LastActivityDate__c(Custom Date field on Case).

Here is pseudo code

    trigger UpdatedRelatedCase on Task(after Update){

    List<Case> lstCasesToUpdate = new List<Case>();

    for(Task newTask : Trigger.new){
        if(
            String.valueOf(newTask.WhatId).startsWith('005') &&
            String.valueOf(newTask.Status).startsWith('Completed') 
        ){
            lstCasesToUpdate.add(
                new Case(
                    Id = newTask.WhatId,
                    LastActivityDate__c = Date.Today()
                )
            );
        }
    }

    if(!lstCasesToUpdate.isEmpty()){
        UPDATE lstCasesToUpdate;
    }

}
| improve this answer | |
  • This is missing code, and would result in no change to the Case, it would not compile either as parentCase is undefined. You'd want a list of CasesToUpdate, and within the for loop add Cases with the updated Date stamp. Then an Update DML operation after the for loop. – Mike Katulka Jul 25 '16 at 21:31
  • I see pseudo code there, so my bad. Read my previous comment for those who would consider really implementing this. – Mike Katulka Jul 25 '16 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.