---
schema_version: "1"
id: 6141fef57fc220e099b2680255a843087cecb006cf0008c0ce9727882fbffa74
title: refreshView() for Lightning Experience
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/api-cti/guides/sforce-api-cti-refreshview-lex.md
canonical_url: https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-refreshview-lex.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f918efad83b1b25e4764ab0f9ef790257bbac3154ab0397c5a04769404d7d060
products:
  - Open CTI Developer Guide
  - Service Cloud Developer Content
---

# refreshView() for Lightning Experience

## Usage

Returns `true` if view refresh is invoked, `false` otherwise. When this method is called within the Salesforce console, it refreshes the current active view. If any related lists are included in this tab, they’re refreshed too. This method is available in API version 38.0 or later.

## Syntax

```javascript
sforce.opencti.refreshView({
     callback:FUNCTION
});
```

## Arguments

|Name|Type|Description|
|------|------|-------------|
|`callback`|function|Optional. JavaScript method executed when the API method call is completed.|


## Sample Code–HTML and JavaScript without a callback

<!-- html set_clipboard -->
```html
<html>
<head>
   <script type="text/javascript" src="http://domain:port/support/api//lightning/opencti_min.js"></script>
   <script type="text/javascript">
	var param = {};
       	function refreshView() {
                	sforce.opencti.refreshView(param);
        	}
</script>
</head>
<body>
       <button onclick="refreshView();">refreshView</button>
</body>
</html>

```

## Sample Code–HTML and JavaScript with a callback

<!-- html set_clipboard -->
```html
<html>
<head>
   <script type="text/javascript" src="http://domain:port/support/api//lightning/opencti_min.js"></script>
   <script type="text/javascript">
	var param = {};
            	var callback = function(response) {
         if (response.success) {
            console.log('API method call executed successfully! returnValue:', response.returnValue);
         } else { 
            console.error('Something went wrong! Errors:', response.errors);
         }
      	};
            param.callback = callback;
       
       function refreshView() {
                sforce.opencti.refreshView(param);
        }
</script>
</head>
<body>
       <button onclick="refreshView();">refreshView</button>
</body>
</html>

```

## 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|
|------|------|-------------|
|`success`|boolean|Returns `true` if the API method call was invoked successfully, `false` otherwise.|
|`returnValue`|object|This API method doesn’t return this object. The `returnValue` is always `null`.|
|`errors`|array|If the API call was successful, this variable is `null`. If the API call failed, this variable returns an array of [error messages](https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-error-messages-lightning.md).|


