Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

updateEmailTemplate(emailTemplateInput)

Update an existing email template with the provided metadata.

API Version

65.0

Requires Chatter

No

Signature

public static ConnectApi.GenericResponseOutputRepresentation updateEmailTemplate(ConnectApi.EmailTemplateInputRepresentation emailTemplateInput)

Parameters

emailTemplateInput
Type: ConnectApi.EmailTemplateInputRepresentation
Input representation that contains the metadata for the email template. The fileId field is not accepted in this Apex representation.

Example

1ConnectApi.EmailTemplateInput input = new ConnectApi.EmailTemplateInput();
2input.name = 'Sample Email Template Updated';
3input.id = 'email-template-id';
4input.emailSubject = 'Email Subject Updated';
5input.description = 'Email template description Updated';
6input.contentDocumentId = '069SB0000047U0mYAE';
7input.activatedDate = Date.today();
8input.deactivatedDate = Date.today().addDays(365);
9input.senderType = 'PredefinedEmail';
10input.senderEmailFieldAPIName = 'noreply@company.com';
11input.replyToType = 'PredefinedEmail';
12input.replyToEmailAddress = 'support@company.com';
13input.bccEmailIdList = 'admin@company.com';
14input.isActive = true;
15input.isDefaultAutoEmailTemplate = false;
16input.isSubjectLineEditable = true;
17input.shouldIgnoreEmailConsent = false;
18input.productId = '01t000000000001';
19input.surveyId = 'survey-001';
20input.communicationSubscriptionId = 'comm-sub-001';
21input.automatedEmailContextType = 'ProviderVisit';
22input.automatedEmailActionType = 'Create';
23input.attachmentObjectTypes = new List<String>();
24input.attachmentObjectTypes.add('Account');
25input.languages = new List<String>();
26input.languages.add('es_AD');
27input.languages.add('es');
28input.topics = new List<String>();
29input.topics.add('Onboarding');
30input.topics.add('User Engagement');
31System.debug(ConnectApi.LifeSciEmailTemplate.updateEmailTemplate(input));