# onObjectUpdate() for Salesforce Classic

## Usage

Registers a function to call when case fields, the feed, or related list data have changed on records that are displayed with a feed-based layout.

:::note
Use this method with Visualforce pages you want to use as custom publishers in Case Feed.
:::

## Syntax

```javascript
sforce.interaction.entityFeed.onObjectUpdate(callback:function)
```

## Arguments

| Name       | Type     | Description                                                       |
| ---------- | -------- | ----------------------------------------------------------------- |
| `callback` | function | JavaScript method executed when the API method call is completed. |

## Sample Code–JavaScript

```javascript
<apex:page standardController="Case">
    <apex:includeScript value="/support/api/26.0/interaction.js"/>
    <script type="text/javascript">
        var callback = function(response) {
            alert('Case was updated. Fields = ' + response.fieldsUpdated +
            ' Related lists = ' + response.relatedListsUpdated + ' Feed = ' + 
              response.feedUpdated);
        };
        //Invokes API method
        sforce.interaction.entityFeed.onObjectUpdate(callback);
    </script>    
</apex:page>
```

## Response

This method is asynchronous. The response is returned in an object passed to a callback method. The response object contains the following fields.

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| `fieldsUpdated`       | boolean | `true` if one or more case fields were updated.        |
| `relatedListsUpdated` | boolean | `true` if one or more case related lists were updated. |
| `feedUpdated`         | boolean | `true` if the case feed was updated.                   |
