You are here:
Export and Import Document Template Custom Classes for Omnistudio Document Generation
If a Document Template uses a custom class, and you want to export the template from one org and import it into another org, you must move the custom class first. Importing a Document Template fails if the target org can't find the custom class associated with it.
In the Execute Anonymous window, run the following script:
List<omnistudio__DocumentTemplate__c> templates= [SELECT Id, Name, omnistudio__VersionNumber__c, CreatedDate, omnistudio__ExternalID__c FROM omnistudio__DocumentTemplate__c];
if(templates != null && templates.size() > 0)
{
for(omnistudio__DocumentTemplate__c t: templates )
{
if( String.isBlank(t.omnistudio__ExternalID__c) )
{
t.omnistudio__ExternalID__c = t.Name + '/' + t.omnistudio__VersionNumber__c + '/' + userInfo.getOrganizationName()+ '/' + t.CreatedDate.getTime();
}
}
update templates;
}Export a Document Template
You can transfer document templates from a source org to another org using the export functionality. Export document templates up to 5.5 MB in size, if the template exceeds this limit, the export request won't be processed.
- Go to the Document Template tab.
- Expand the template to export.
-
Click Export.
The Export DataPack dialog box opens.
By default, the template are selected.
- Click Next.
- Review the DataPack export list.
- Click Next.
-
Enter the following information:
-
Name is the name of the DataPack.
-
Type is the primary object type of the DataPack contents, in this case, Document Template.
-
Description is a brief description of what the DataPack contains.
-
-
Select one or more of the following options:
-
To add a copy of the DataPack to the Vlocity DataPacks – Published tab, select Add to Library.
-
To make the DataPack accessible to other Salesforce orgs, select Published.
-
To create a new version of this DataPack, select Create New Version. To overwrite the current version of this DataPack, clear Create New Version.
-
If necessary, in Version, enter the version number.
-
-
Click Done.
The DataPack is downloaded as a .json file.
Import a Document Template
To import a document template:
- Go to the Document Template tab.
-
Click Import Template.
The Select File dialog box opens.
- Click Browse.
- Find the .json file to import and click Open.
-
Click Next.
The Select Items to Import dialog box opens.
- Select the template to import.
- Click Next.
- Review the items to import.
- Click Next.
- When the Import Complete message opens, click Done.


