Creating Dynamic Content

  • iPad

Content creators can develop dynamic content to enable end users to generate personalized versions of content for HCPs and share them via Approved Email. This allows end users to follow up with HCPs about the personalized content discussed while presenting CLM content, for example, a cost calculator, formulary matrix, or personalized reprint.

English is the only supported language for dynamic content.

Dynamic content consists of the following components:

  • Dynamic Content Template – Content creators create dynamic content templates, which are PDF documents containing form fields. These form fields populate with personalized values from the corresponding CLM content.
  • CLM Content – Content creators create CLM content that contains data from CRM or external sources, calculations, or user input. This data maps to specific form field identifiers in the dynamic content template.
  • Email Template or Email Fragment – Content creators create an Email Template or Email Fragment for sharing the personalized version of the dynamic content via Approved Email

See Generating and Sending Dynamic Content for more information about generating and sending dynamic content to HCPs as an end user.

Creating the Dynamic Content Template

The dynamic content template must satisfy the following requirements:

  • Must be a PDF containing form fields. The name of each field is the identifier.
  • Must be uploaded into PromoMats/MedComms using any document type (Promotional Piece, Reference Document, etc.)

    Ensure the Vault (PromoMats/MedComms) integration user defined in the CLM Admin Console has access to the document type and the permission to download document source files from Vault. This user retrieves the document when generating the dynamic content. See Vault Help for more information about downloading document source files.

  • Any font can be used as long as the entire font is embedded in the PDF. See Adobe documentation for more information about embedding fonts in PDF documents.

Dynamic Content Template

Generated Personalized Content

Creating the CLM Content

Content creators must use two JavaScript methods in CLM content, one to generate dynamic content and one to allow end users to share it through Approved Email:

  • generateDynamicContent(vaultId, documentNum, account, expiryPeriod, allowDownload, displayName, values, callback) – Retrieves the specified dynamic content template from PromoMats/MedComms, then creates and publishes a personalized PDF version of CLM content with the field values provided. The personalized PDF is published and stored in Veeva CRM as a Salesforce File attached to a Veeva_Content_vod record.
    • This method must be associated with a user action in the CLM content. When the end user selects the action, a loading indicator displays while the personalized PDF version of the content is generated in the background. The end users can select Cancel in the loading indicator to cancel the request.
    • The following fields on the Veeva_Content_vod record are populated based on the parameters:
    • Name – Populated from the displayName parameter. This is the name displayed in the HCP Content Player when an HCP accesses the link to the content.
    • Account_vod – Populated from the account parameter. This is a lookup field to the Account record.
    • Allow_Source_Download_vod – Populated from the allowDownload parameter. When this value is set to true, a download button displays in the HCP Content Player.
    • Expiration_Date_vod – Populated from the expiryPeriod parameter. This is calculated from the sum of the content’s creation date and the expiryPeriod value. If expiryPeriod is empty, this field is not populated.
    • Dynamic_Content_Vault_Doc_ID_vod – Populated from the documentNum parameter. This is the Document ID of the dynamic content template stored in PromoMats/MedComms and can be used for reporting on which dynamic content templates are used and shared.
    • Dynamic_Content_Vault_Instance_ID_vod – Populated from the vaultId parameter. This is the Vault Instance ID of the dynamic content template stored in PromoMats/MedComms.
    • The values parameter is a JSON object containing the fields and values mapped to the form fields in the dynamic content template. The values are resolved when generating the personalized version.
    • The total supported request size is 1MB
    • Images can be included as a value. Images should be included as a base64 data URI. For example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=
    • The Veeva_Content_vod record is returned in the generateDynamicContent method's success response so it can be provided to the launchApprovedEmailWithVeevaContent JavaScript method
  • launchApprovedEmailWithVeevaContent(email_template, email_fragments, veeva_content, callback) – Launches the specified email template or email fragment in Approved Email from CLM content containing a link to the personalized PDF. This method can be used as a callback function for generateDynamicContent to immediately display Approved Email after generating the personalized PDF.

See Creating HTML Content for more information about creating CLM content.

Code Sample


Code Sample

// first, get the current Account Id, store it in a global scope variable called "accountId"
function getCurrentAccount() {
    com.veeva.clm.getDataForCurrentObject("Account","Id", getTemplateDocId);

// second, get the Email Template (and Email Fragments, if applicable), store it in a global scope variable called "myTemplate"
function getTemplateDocId(result) {
    if (result.success == true) { 
        accountId = result.Account.Id;
        com.veeva.clm.getApprovedDocument("","7002", generateContent);

// third, generate the content, return type is the Veeva Content record ID of the generated content  
function generateContent(result) {
    if (result.success == true) { 
        myTemplate = result.Approved_Document_vod__c.ID;
        vaultId = "";
        documentNum = "7702";
        expiryPeriod = 30;
        allowDownload = true;
        displayName = "Natevba - Precision Targeting Report";
        // values to resolve in the generated content
        var values = {};
        values.field1 = "1,000";
        values.field2 = "725";
        values.field3 = "100";
        values.field4 = "50";
        values.image1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";

        // generate content and launch Approved Email
        com.veeva.clm.generateDynamicContent(vaultId, documentNum, accountId, expiryPeriod, allowDownload, displayName, values, launchAE);

// last, launch Approved Email with the generated content
function launchAE(result) {
    if (result.success == true) { 
        com.veeva.clm.launchApprovedEmailWithVeevaContent(myTemplate, "",, callback);

function callback(result) {}

Troubleshooting Errors

The following are errors that may occur when using the genericDynamicContent method.

Error Message




User is missing required configuration: {0}.

0 = Object/Object.Field API Name


The user does not have the required permissions to execute the generateDynamicContent() request.

Enable OLS/FLS for the user on the object or object field specified in the error message.

No Internet connection.


No internet connection. The system cannot complete the generateDynamicContent() request.

Connect to the Internet and try again. An Internet connection is required to execute the generateDynamicContent() request. 

Unable to connect with PromoMats/MedComms Vault.


The system cannot communicate with the PromoMats/MedComms Vault to obtain the document source file.

Verify the credentials are valid for the Vault (PromoMats/MedComms) integration user defined in the CLM Admin Console.

Defined document_num cannot be found.


The dynamic content template cannot be found in the specified PromoMats/MedComms Vault.

Set the dynamic content template document number to a document that exists in the specified PromoMats/MedComms Vault. Ensure the PromoMats/MedComms integration user defined in the CLM Admin Console has access to the document type.

Unable to obtain source file for defined document_num.


The system cannot obtain the source file for the dynamic content template.

Grant the Vault (PromoMats/MedComms) integration user defined in the CLM Admin Console the permission to download document source files.

Defined document_num is not in Steady State.


The dynamic content template is not in a Steady State in the specified PromoMats/MedComms Vault.

Move the dynamic content template to a Steady State in PromoMats/MedComms.

Unable to generate content due to malformed JSON in the defined values.


The JSON object provided for the values parameter of the method is malformed.

Ensure the JSON object for the values parameter is valid. For example: { "field1": "100,000", "field2": "0.1%", "field3": "10%" }

Unable to generate content due to invalid format for the defined document template.


The dynamic content template cannot be parsed.

Ensure the specified dynamic content template is a PDF containing form fields. 

Missing required parameter: {0}.

0 = Field Name


The generateDynamicContent() request is missing a required parameter.

Ensure the required parameters are passed into the method. expiryPeriod is the only optional parameter. 

If expiryPeriod is not applicable for the content, populate the parameter with “”.

An unexpected error occurred.


The request to the system is not supported. This error typically occurs when the system is unable to process the content provided. 

Possible unsupported content errors:

  • The request size exceeds 3MB. This can occur when multiple base64 data URIs for large images are included in the content.
  • The content includes unsupported characters

Ensure the following conditions are met:

  • The request size is less than 3MB. Converting images from PNG to JPG can allow for more images to be included in the request.
  • The dynamic content template and provided values are in English

Creating the Email Template or Email Fragment

The Email Template or Email Fragment must include the {{DynamicContentLink}} token. When an end user sends an email containing dynamic content to an HCP, this token is replaced with the URL to the personalized PDF. When recipients access the link, the PDF displays in the HCP Content Player. See Creating Approved Email Templates and Creating Approved Email Fragments for more information.

The Email Template or Email Fragment containing the {{DynamicContentLink}} token must be launched from CLM via the launchApprovedEmailWithVeevaContent method to ensure the personalized PDF version (Veeva Content record) can be provided as a parameter.

Approved Email content containing the {{DynamicContentLink}} token is not applicable to any other Approved Email entry points. Mark this content as hidden to ensure it does not display as an option to select when composing Approved Emails from other entry points. See Preventing Approved Email Content from Displaying for more information.

Expiring Dynamic Content

Admins can expire published dynamic content in CRM. When an HCP accesses a link to expired content, an error message displays.

To expire published dynamic content:

  1. Navigate to the appropriate Veeva_Content_vod record with the Dynamic_Content_vod record type.
  2. Select Edit.
  3. Select Expired_vod for the Content_Status_vod field.
  4. Select Save.

Testing Dynamic CLM Content

CLM test users (users with the Enable_CLM_Testing_Features_vod check box selected on their User record) can test the dynamic content on their devices. Both Steady State and Non Steady State dynamic content templates can be used for test users. If a dynamic content template has both Steady State and Non Steady State versions, the latest version is used.