---
schema_version: "1"
id: 789c39fdcf579532189686a14a4cbd3cf346a3c51d6dc02c0dfdc4981c7b5ca3
title: saveLog() for Salesforce Classic
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-savelog.md
canonical_url: https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-savelog.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 344c2dc0b5eb538ac029d9fecc8eb9307e6be46f0293b565846580c827b4768d
products:
  - Open CTI Developer Guide
  - Service Cloud Developer Content
---

# saveLog() for Salesforce Classic

## Usage

Saves or updates an object in Salesforce.

**note:** If an object uses `recordType`, pass the `recordTypeId` in the `saveLog` call. If you don’t pass the `recordType`, the record is created using the default `recordType` for the profile. For person accounts, you can't pass the person account `recordType` if the profile's default is to a business account.

## Syntax

```javascript
sforce.interaction.saveLog(object:string, saveParams:string, (optional)callback:function)
```

## Arguments

|Name|Type|Description|
|------|------|-------------|
|`object`|string|The name of the object to save or update.|
|`saveParams`|string|Specifies the fields to save or update on the object.If the object’s ID is specified, a record is updated. For example: `Id=001D000000J6qIX&Name=Acme&Phone=4154561515`. If the object’s ID isn’t specified, a new record is created. For example: `Name=Acme&Phone=4154561515`.|
|`callback`|function|JavaScript method executed when the API method call is completed.|


## Sample Code–JavaScript

<!-- javascript set_clipboard -->
```javascript
<html>
<head>
   <script type="text/javascript" src="http://domain:port/support/api/25.0/interaction.js"></script>
   <script type="text/javascript">
       var callback = function (response) {
           if (response.result) {
                  alert(response.result);
           } else { 
                  alert(response.error);
           }
       } 
       function saveLog() {
           //Invokes API method
                sforce.interaction.saveLog('Account','Name=NewAccountName&Phone=4155551212', callback);
       } 
</script>
</head>
   <button onclick="saveLog();">saveLog</button>
</html>
```

## Response

|Name|Type|Description|
|------|------|-------------|
|`result`|boolean|`true` if saving or updating the object was successful, `false` if saving or updating the object wasn’t successful.|
|`id`|string|The Id of the newly created object.|
|`error`|string|If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message.|


