Skip to content

Instantly share code, notes, and snippets.

Avatar
🌎
Working from home

Amit Singh amitastreait

🌎
Working from home
View GitHub Profile
View UserInformation.js
import { LightningElement } from 'lwc';
export default class UserInformation extends LightningElement {
/* The Example JSON file */
person = {
"First Name": "Rack's",
"Last Name": "Jackon",
"Gender": "man",
"Age": 24,
"Street Address": "126",
View TwilioService.java
public class TwilioService {
@InvocableMethod(label='Send Verification SMS' description='Send Verification SMS' category='Login' callout=true)
public static List<TwilioService.InputWrapper> run(List<TwilioService.InputWrapper> code){
sendSMS(code.get(0));
return code;
}
private static void sendSMS(TwilioService.InputWrapper input){
View Accounts.json
{
"records": [
{
"attributes": {
"type": "Account",
"referenceId": "AccountRef1"
},
"AccountId": 9000,
"Name": "Alpha Dynamics",
"Type": "Technology Partner",
View Contacts.json
{
"records": [
{
"attributes": {
"type": "Contact",
"referenceId": "ContactRef1"
},
"Id": 1,
"AccountId": "@AccountRef1",
"FirstName": "Amy",
@amitastreait
amitastreait / PathComponent.html
Last active Mar 9, 2022
Create custom path component using lightning web component
View PathComponent.html
<template>
<lightning-card variant="Narrow" >
<lightning-spinner alternative-text="Loading" size="small" if:true={isLoading}></lightning-spinner>
<!--Display the button on the top-->
<p slot="actions" if:true={isTop}>
<lightning-button if:true={showButton} variant="brand" label={buttonLabel} title={buttonLabel} onclick={handleClick}></lightning-button>
</p>
<div class="slds-m-around_small" if:true={isTop}>
<lightning-progress-indicator current-step={currentValue} type={pathType} has-error="false" variant="shaded">
<template if:true={pathValues} for:each={pathValues} for:item="step" for:index="index">
View LogoutEventTriggerTest.java
@isTest
public class LogoutEventTriggerTest {
@isTest
public static void logOutTest() {
LogoutEventStream stream = new LogoutEventStream(
);
EventBus.publish(stream);
}
View ToastComponent.js
import { api, LightningElement } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class ToastComponent extends LightningElement {
@api title;
/* Title of the toast */
@api message;
/*
Message of the toast. If you wanted to display the Clickable url in the toast then the message format will be
'Record {0} created! See it {1}!'
View OTPGenerator.java
public class OTPGenerator {
@InvocableMethod(description='This method will be generating the OTP for users to Login'
label='Generate OTP'
category='OTP')
public static List<String> generateOtp(){
List<String> responseList = new List<String>();
String randomIntegerString = string.valueof(Math.abs(Crypto.getRandomInteger()));
String otp = randomIntegerString.substring(0,6);
responseList.add(otp);
View AutoLeadConvertVF.htm
<apex:page standardController="Lead" recordSetVar="leadRecord" extensions="VE_AutoLeadController" lightningStylesheets="true" >
<apex:slds />
<!-- LEFT({!$Api.Partner_Server_URL_260}, FIND( '/services', {!$Api.Partner_Server_URL_260})) -->
<!-- LEFT( {!$Flow.FaultMessage}, Find("You can look up ExceptionCode", {!$Flow.FaultMessage} ) -1) -->
<apex:pageBlock title="Selected Records">
<apex:pageBlockTable value="{!selectedLeadRecords}" var="lead">
<apex:column headerValue="Name" value="{!lead.Name}" />
<apex:column headerValue="Email" value="{!lead.Email}" />
<apex:column headerValue="Company" value="{!lead.Company}" />
<apex:column headerValue="Rating" value="{!lead.Rating}" />
View VE_AutoLeadController.java
public class VE_AutoLeadController {
public List<String> leadIdsSet { get; set; }
public List<Lead> selectedLeadRecords { get; set; }
public VE_AutoLeadController(ApexPages.StandardSetController setController) {
selectedLeadRecords = (Lead[])setController.getSelected();
leadIdsSet = new List<String>();
for(sObject sobj : setController.getSelected()){
leadIdsSet.add( (String)sObj.get('Id') );