- Create a package.xml file
- Create a destructiveChanges.xml file
- Bundle the two files together in a .zip file
- Deploy the .zip package using Workbench
- Open the migration menu, then click Deploy
| <aura:component controller="EmailTemplateLookupController"> | |
| <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> | |
| <aura:handler name="change" value="{!v.selectedRecordId}" action="{!c.onChange}"/> | |
| <aura:attribute name="label" type="String" /> | |
| <aura:attribute name="objectName" type="String" /> | |
| <aura:attribute name="fieldName" type="String" /> | |
| <aura:attribute name="recordId" type="String" /> |
| public Set<Id> getFiles(Id recordId) { | |
| List<ContentDocumentLink> files = [SELECT ContentDocumentId | |
| FROM ContentDocumentLink | |
| WHERE LinkedEntityId IN ( SELECT Id FROM CUSTOM_OBJECT_NAME__c ) | |
| AND LinkedEntity.Type='CUSTOM_OBJECT_NAME__c' | |
| AND LinkedEntityId = :recordId]; | |
| if (files.size() > 0) { | |
| return (new Map<Id, ContentDocumentLink>(files)).keySet(); |
| validateFields : function(cmp, event, helper){ | |
| var isValid = true; | |
| var fields = []; | |
| fields = cmp.find("field"); | |
| for (var i = 0; i < fields.length; i++) { | |
| if (fields[i] != null){ | |
| if (fields[i].get('v.validity').valid == false){ |
| openModel : function(cmp, componentName, params, modelId, header, cssClass, callback) { | |
| var modalBody; | |
| $A.createComponent(componentName, params, | |
| function(content, status) { | |
| if (status === "SUCCESS") { | |
| modalBody = content; | |
| cmp.find(modelId).showCustomModal({ | |
| header: header, | |
| body: modalBody, | |
| cssClass: cssClass, |
| castBooleanPropertiesToString : function(object) { | |
| var props = Object.getOwnPropertyNames(object); | |
| for (var i = 0; i < props.length; i++) { | |
| var propName = props[i]; | |
| if (typeof object[propName] == 'boolean'){ | |
| object[propName] = object[propName].toString(); | |
| } | |
| } | |
| }, |
| promiseAction : function(cmp, methodName, params){ | |
| console.log(methodName); | |
| console.log(params); | |
| return new Promise(function(resolve, reject) { | |
| var action = cmp.get(methodName); | |
| action.setParams(params); | |
| action.setCallback(this, function(response) { | |
| var state = response.getState(); | |
| console.log(methodName + ' ' + state); | |
| if(cmp.isValid() && state === "SUCCESS"){ |
| callAction : function(cmp, methodName, params, callback){ | |
| var action = cmp.get(methodName); | |
| action.setParams(params); | |
| action.setCallback(this, function(response) { | |
| var state = response.getState(); | |
| console.log(methodName + ' ' + state); | |
| if(cmp.isValid() && state === "SUCCESS"){ | |
| var result = response.getReturnValue(); | |
| console.log(result); | |
| if (callback) callback(result); |
| global class EmailAction { | |
| @InvocableMethod(label='Send Email') | |
| global static List<EmailActionResult> sendEmails(List<EmailActionRequest> requests) { | |
| List<EmailActionResult> results = new List<EmailActionResult>(); | |
| for(EmailActionRequest request : requests){ | |
| results.add(sendEmail(request)); | |
| } |
| global class DeleteRecordAction { | |
| @InvocableMethod(label='Delete Record') | |
| global static void deleteRecords(List<DeleteRecordActionRequest> requests) { | |
| for(DeleteRecordActionRequest request : requests){ | |
| deleteRecord(request); | |
| } | |
| } |