This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component controller="S3FileController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > | |
<ltng:require scripts="/resource/AWSSDK" afterScriptsLoaded="{!c.doInit}"/> | |
<aura:attribute name="recordId" type="String" /> | |
<lightning:button variant="brand" label="Download File" onclick="{!c.getFile}" /> | |
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GoogleAuthService { | |
// use your information at ***** | |
private static string key = '******************************.apps.googleusercontent.com'; | |
private Static string secert = '******************************'; | |
private Static string redirect_uri = 'https://*******-stackoverflow-dev-ed.lightning.force.com/lightning/n/GDriveStore'; | |
private static string authUrl='https://accounts.google.com/o/oauth2/auth'; | |
private static string scope='https://www.googleapis.com/auth/cloud-platform'; | |
private static string tokenUrl='https://accounts.google.com/o/oauth2/token'; | |
@AuraEnabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component controller="GoogleAuthService" implements="lightning:isUrlAddressable,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> | |
<aura:attribute name="accessToken" type="String" /> | |
<lightning:card title="Google Transcription"> | |
<lightning:button variant="brand" label="Authorize Google" title="Google Drive Auth" onclick="{! c.doAuth }" /> | |
</lightning:card> | |
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MetadataService { | |
public static void UpdateCustomMetadata(string token) { | |
Metadata.CustomMetadata customMetadata = new Metadata.CustomMetadata(); | |
customMetadata.fullName = 'GoogleAuthSetting.AccessToken'; | |
customMetadata.label = 'AccessToken'; | |
customMetadata.protected_x = true; | |
Metadata.CustomMetadataValue accessToken = new Metadata.CustomMetadataValue(); | |
accessToken.field = 'AccessToken__c'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component controller="GoogleSpeechService" implements="lightning:isUrlAddressable,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > | |
<aura:attribute name="recordId" type="String"/> | |
<lightning:card title="Google Transcription"> | |
<lightning:button variant="brand" label="Convert Audio to Text" title="Convert Audio to Text" onclick="{! c.translate }" /> | |
<lightning:textarea name="translatedText" label="" value="Transcript Placeholder" /> | |
</lightning:card> | |
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AudioData { | |
public class Audio { | |
public String content; | |
} | |
public class Config { | |
public String encoding; | |
public Integer sampleRateHertz; | |
public String languageCode; | |
public Boolean enableWordTimeOffsets; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public without sharing class FileReader { | |
private static final String BASE_URL = URL.getSalesforceBaseUrl().toExternalForm(); | |
//Reterives all files of one case or account record | |
@AuraEnabled | |
public static List<FileData> GetEntityRecordFiles(string recordId) | |
{ | |
List<ContentDocumentLink> links=[SELECT ContentDocumentId,LinkedEntityId FROM ContentDocumentLink where LinkedEntityId=:recordId]; | |
Set<Id> ids=new Set<Id>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component | |
controller="FileReader" | |
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" | |
access="global"> | |
<aura:attribute name="data" type="String" /> | |
<aura:attribute name="previewUrl" type="String" /> | |
<aura:attribute name="urlLink" type="String" /> | |
<aura:attribute name="recordId" type="String" /> | |
<aura:attribute name="files" type="object[]" /> | |
<aura:attribute name="file" type="object" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmailHelper { | |
public boolean sendErrorNotification(string jobId) | |
{ | |
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage(); | |
message.toAddresses = new String[] { 'itops@salesforcecodex.com' }; | |
message.subject = 'Error in Job :' +jobId ; | |
message.htmlbody = 'Hello Admin, </br>There is error in job.</br> Please check</br></br>. Apex Job'; | |
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message}; | |
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UpdateCaseQueuable implements Queueable { | |
public List<Case> caseList ; | |
public UpdateCaseQueuable(List<Case> cases){ | |
this.caseList = cases ; | |
} | |
public void execute(QueueableContext context) { | |
for(Case a :caseList){ | |
a.Description ='Updated from UpdateCaseQueuable'; | |
a.Status='Closed'; |