CLM Content Creation Guide 24R1
// 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("https://my-test-vault.veevavault.-
com","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 = "https://my-test-vault.veevavault.com";
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:im-
age/png;-
base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY-
42YAAAAASUVORK5CYII=";
// 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, "", res-
ult.id, callback);
}
}
function callback(result) {}
Troubleshooting Errors
The following are errors that may occur when using the genericDynamicContent method.
Veeva Systems Confidential Information
(For use only by licensed Customers of Veeva Systems)
22