Skip to content

Instantly share code, notes, and snippets.

View hicglobalsolutions's full-sized avatar
🎯
Focusing

HIC Global Solutions hicglobalsolutions

🎯
Focusing
View GitHub Profile
h1 {
font-size: 1.5rem;
font-weight: 600;
color: #1a1a1a;
text-align: center;
margin-bottom: 1rem;
}
.main-card {
import { LightningElement } from 'lwc';
import encryptdata from '@salesforce/apex/encryptDecryptHandler.encryptdata';
import decryptdata from '@salesforce/apex/encryptDecryptHandler.decryptdata';
import generateRandomKey from '@salesforce/apex/encryptDecryptHandler.generateRandomKey';
import app_wallpaper from '@salesforce/resourceUrl/Blog_Wallpaper';
export default class encryptDecryptLWC extends LightningElement {
// Wallpaper & Algorithm Options
appWallpaper = app_wallpaper;
<template>
<div style={divStyle} class="main-card">
<div class="glass-container">
<h1>Awesome Encryptor</h1>
<div>
<!-- Encryption Section -->
<div if:true={isNotEncrypted} class="glass-card">
<lightning-combobox options={algoOptions} value={algoValue} label="Select Encryption Algorithm"
public with sharing class encryptDecryptHandler {
@AuraEnabled
public static string encryptdata(String algorithmType, String secretKey, String clearText) {
String algorithmName = algorithmType;
Blob key = Blob.valueOf(secretKey);
Blob data = Blob.valueOf(clearText);
Blob encrypted = Crypto.encryptWithManagedIV(algorithmName, key, data);
String base64Encrypted = EncodingUtil.base64Encode(encrypted);
return base64Encrypted;
}
public class CopilotCompanyAPI {
public static void createCompany() {
String name = 'Copilot Inc';
String url = 'https://api.copilot.app/v1/companies';
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('POST');
req.setHeader('Authorization', 'Bearer YOUR_API_KEY_HERE' );
req.setHeader('Content-Type', 'application/json');
req.setHeader('accept', 'application/json');
public class CopilotCompanyAPI {
public static void listCompanies() {
String url = 'https://api.copilot.app/v1/companies';
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod( 'GET');
req.setHeader('Authorization', 'Bearer YOUR_API_KEY_HERE' );
req.setHeader('Content-Type', 'application/json');
req.setHeader('accept', 'application/json');
public class CopilotAPI {
public static void createClient() {
String firstName='Salesforce';
String lastName='Integration';
String email='test@gmail.com';
String url = 'https://api.copilot.app/v1/clients';
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('POST');
req.setHeader('Authorization', 'Bearer YOUR_API_KEY_HERE');
public class CopilotAPI {
public static void getClient() {
String url = 'https://api.copilot.app/v1/clients';
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
req.setHeader('Authorization', 'Bearer YOUR_API_KEY_HERE' );
req.setHeader('Content-Type', 'application/json');
req.setHeader('accept', 'application/json');
public with sharing class CDCDemoBlogController {
@AuraEnabled
public static List<Opportunity> getStatusFields(Id recordId) {
List<Opportunity> opportunityList = [SELECT Id, StageName FROM Opportunity WHERE ID =: recordId LIMIT 1];
if(opportunityList != Null){
return opportunityList;
}
return null;
import { LightningElement, wire, track, api } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import updateStatus from '@salesforce/apex/CDCDemoBlogController.updateStatus';
import getStatusFields from '@salesforce/apex/CDCDemoBlogController.getStatusFields';
import { subscribe, unsubscribe, onError } from 'lightning/empApi';
import { getRecordNotifyChange } from 'lightning/uiRecordApi';
export default class CDCDemoBlog extends LightningElement {