3

On a standard object layout when you inline edit a single field, all the fields displayed on the layout are updated. Could be possible that only the field(s) that have been modified are updated?

Consider this scenario:

  • You are using the Service Console
    • You have an Account open as primary tab
    • You have a Case related to the account, open as a sub tab
    • You close the case using the standard Close button
    • Upon the case closure, an apex trigger will update a field called Status on the account from value "OLD_VALUE" to "NEW_VALUE"
    • You go back to account primary tab, where the status field is still showing as "OLD_VALUE"
    • You inline edit ONLY the account description and Save

As a result, account Status value is again "OLD_VALUE". Saving the account record after an inline edit will override the Status field also (and all others present on layout).

  • Could replace the detail page with a visualforce page & do your own onchange actions. I tried this about a year ago and it ended up being very painful to maintain. – battery.cord Jun 28 '18 at 13:43
  • 1
    This is a problem related to your tabs not refreshng when the Case is updated after the trigger fires. I'd expect that your Account page SHOULD give you a message telling you the data has been changed BEFORE it allows you to save the record. – crmprogdev Jun 28 '18 at 14:34
1

This solution works for me and I have tested at my DE. You have a problem of tab refreshing.

Solution

In the console App configuration, change the following values as follows:

Choose How Lists Refresh = Refresh List (I think it has been configured as None at your org)

Choose How Detail Pages Refresh = Automatically Refresh (I think it has been configured as Do Not Refresh at your org).

Now, after saving the case record from the subtab, if you go to Account Primary tab, you will see the updated account status value.

So, before any inline edits you will always see updated Account value.

Here is the console App configuration.

console

Trigger code

trigger CaseTrigger2 on Case (after insert, after update) {
    List<Case> caseList = new List<Case>();

    Map<String, String> accMap = New Map<String, String>();

    if(Trigger.isAfter && Trigger.isInsert){
        for (Case caseObj : Trigger.new)
        {
            accMap.put(caseObj.AccountId, caseObj.status);            
        }

        List<Account> lstAccount = [SELECT Id, Case_Status__c FROM Account WHERE Id IN:accMap.keySet()];
        for(Account acc:lstAccount)
        {
            acc.Case_Status__c = accMap.get(acc.Id);        
        }
        update lstAccount;
    }
}

Testing outcome

Here, changing the case status to Cancelled and just after saving navigating to Primary tab, Details - where I can see the updated Account's status as Cancelled

Case status update

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.