Source: https://vaultcrmhelp.veeva.com/doc/Content/CRM_topics/Multichannel/CLM/CreatingContent/CreateHTML/CreateUpdate.htm

## Creating and Updating Records from CLM

* Object Model

The [createRecord,](https://developer.veevacrm.com/doc/Content/CRM_topics/Vault/clm-vault.htm#createRecordobjectvaluescallback) [updateRecord](https://developer.veevacrm.com/doc/Content/CRM_topics/Vault/clm-vault.htm#updateRecordobjectrecordvaluescallback), and [updateCurrentRecord](https://developer.veevacrm.com/doc/Content/CRM_topics/Vault/clm-vault.htm#updateCurrentRecordobjectvaluescallback) JavaScript functions can be used to capture data for custom and Veeva-defined objects. Since application logic and validation are not executed when using these functions, all content must be rigorously tested before publishing into production.

These JavaScript functions support attachment fields, allowing content creators to create and update records with long text strings from CLM content. The long text strings are stored as .txt files in Vault CRM with a maximum size of 1.2 MB.

**Who can use this feature?**

* Content Creator Users - Browser
* [Create and update records when exiting CLM](#CreateUpdate)
* End Users - CRM Desktop (Windows), iPad, Windows
* Users do not require an additional license

### Configuring Attachment Fields for Creating and Updating Records from CLM for

[![Closed](../../../../../../Skins/Default/Stylesheets/Images/transparent.gif)Business Admin Users](#)

To configure this feature:

1. Navigate to **Admin > Configuration > Objects > VMobile Object Configuration > Layouts**.
2. Place the **Include Attachment Field List (include\_attachment\_field\_list\_\_v)** field on the appropriate layouts.
3. Navigate to **Admin > Users & Groups > Permission Sets**.
4. Select the appropriate permission set.
5. Select the **Objects** tab.
6. Grant the following permissions:

   | Objects | Object Permissions | Object Types | Fields | Field Permission |
   | --- | --- | --- | --- | --- |
   | vmobile\_object\_configuration\_\_v | R | tablet\_\_v | include\_attachment\_field\_list\_\_v | Read |

[![Closed](../../../../../../Skins/Default/Stylesheets/Images/transparent.gif)End Users](#)

To configure this feature:

1. Navigate to **Admin > Users & Groups > Permission Sets**.
2. Select the appropriate permission set.
3. Select the **Objects** tab.
4. Grant the following permissions:

   | Objects | Object Permissions | Object Types | Fields | Field Permission |
   | --- | --- | --- | --- | --- |
   | vmobile\_object\_configuration\_\_v | R | tablet\_\_v | include\_attachment\_field\_list\_\_v | Read |
5. Navigate to **Business Admin > Objects > VMobile Object Configurations**.
6. Navigate to the VMOC for the applicable object.
7. Define the attachment fields in the **include\_attachment\_field\_list\_\_v** field. This is a double semi-colon delimited list. This ensures specific attachment fields sync to end user devices.
8. Ensure the VMOC is **Active**.

### Creating and Updating Records When Exiting CLM

[![Closed](../../../../../../Skins/Default/Stylesheets/Images/transparent.gif)Content Creator Users](#)

Content creators can use the following functions to allow end users to save information to Vault CRM when navigating between slides or exiting CLM:

* createRecordsOnExit()
* updateRecordsOnExit()
* updateCurrentRecordsOnExit()

Do not use the createRecord function to create call2\_key\_message\_\_v records. Doing so interferes with Veeva-defined logic for call key messages.

To help format these functions, use the following helper functions to return strings for use with the OnExit functions:

* [formatCreateRecords(object array, values array)](https://developer.veevacrm.com/doc/Content/CRM_topics/Vault/clm-vault.htm#formatCreateRecordsobjectArrayvalueArray)
* [formatUpdateRecords(object array, record array, values array)](https://developer.veevacrm.com/doc/Content/CRM_topics/Vault/clm-vault.htm#formatUpdateRecordsobjectNameArrayobjectIdArrayvalueArray)
* [formatUpdateCurrentRecords(object array, values array)](https://developer.veevacrm.com/doc/Content/CRM_topics/Vault/clm-vault.htm#formatUpdateCurrentRecordsobjectArrayvalueArray)

The exit functions cannot include alert or confirmation dialogues requiring user interaction.

Content must be written to Vault CRM objects using the API. Local storage is not supported.

Attachment fields are not supported for the OnExit and format functions. Additionally, custom attachment fields are not supported on the user\_\_sys object.

[Copy](javascript:void(0);)

Sample code

```
com.veeva.clm.updateCurrentRecordsOnExit = function() {
  var object1 = Account;
  var values1 = {};
  values1.Preferred_Statin__c = Juvastatin!;
  var object2 = KeyMessage;
  var values2 = {};
  values2.Customer_Field__c = Saved information;
  var objectArray = [object1, object2];
  var valuesArray = [values1, values2];
  return com.veeva.clm.formatUpdateCurrentRecords (objectArray, valuesArray);
}
```

### Related Topics

[Creating Dynamic Content](DynamicContent.htm)

[Creating Interactive HTML Content](../CreateInteractiveHTML.htm)

[Customizing Slide Navigation](CustomSlideNav.htm)
