Skip to content

Instantly share code, notes, and snippets.

View LokeshSagi's full-sized avatar

Lokesh Sagi LokeshSagi

  • MTX Group Inc
  • Hyderabad
View GitHub Profile
@LokeshSagi
LokeshSagi / AutoGenerateSurveyInvitationLink.cls
Last active July 10, 2020 06:52
Apex controller to auto generate a survey invitation link - Call this controller method from any aura or LWC component to automatically generate invitation link. We can also populate this link a custom field value anywhere and send email to the invitee automatically with process automation. Watch this video: https://screencast-o-matic.com/watch/…
@LokeshSagi
LokeshSagi / copytoclipboard.html
Created July 6, 2020 11:24
Copy something to clipboard onclick
<lightning-input name="input5" label="Sample text" class="slds-p-bottom_medium" data-field="text" ></lightning-input>
<lightning-button variant="brand" label="Copy text" title="Share Guide" icon-name="utility:copy"
onclick={copyTextToClipboard} class="js-copy-btn slds-m-left_x-small"></lightning-button>
@LokeshSagi
LokeshSagi / lwcNavigation.html
Last active July 6, 2020 11:11
All types of possible navigations in LWC
<template>
<lightning-card title={heading}>
<lightning-layout horizontal-align="center" vertical-align="center" multiple-rows>
<lightning-layout-item padding="around-small" size="3">
<lightning-button label="LWC Practice" onclick={navigateTab} icon-name="custom:custom34">
</lightning-button>
</lightning-layout-item>
<lightning-layout-item padding="around-small" size="3">
@LokeshSagi
LokeshSagi / QRCodeGenerator
Created July 6, 2020 07:11
Follow these steps to generate a QR Code in custom field (in any object) and upon scanning the code with scanner, navigate the user to specified URL
-> Create a formula field (ex: QRCode) with below value
IMAGE('https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=https://developer-myorg.cs10.force.com/playground/s/community_page?record=003xxxxxxxxxxx' ,'Scan QR code to open record in mobile.')
@LokeshSagi
LokeshSagi / FilePreviewAndDownload
Last active May 29, 2024 12:45
File Preview and download (all types of contents) in Community
Create these Custom Labels:
Preview_URL:
/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=
Download_URL:
/community_name/sfc/servlet.shepherd/document/download/
@LokeshSagi
LokeshSagi / showHide.css
Last active July 6, 2020 11:36
Dynamically show/hide the data coming from backend on the UI using css and dataset - In this example, whenever data-ccr = 'CCR', the particular td doesnt show value on UI
td[data-ccr="CCR"] span {
display: none;
}
@LokeshSagi
LokeshSagi / Steps
Created July 6, 2020 06:14
VSCode snippet to import Custom Label in JS
-> Click on Settings (wrench icon) and select User Snippets
-> Select the type of snippet (generally select 'New Global Snippet File' to create a snippet and make it available across the projects and languages)
-> give a snippet name
-> copy the code from above file (change the scope, prefix, description as required)
-> in the required js, ts file, start typing 'imp-label' and select the suggestion with the given decription.
Create the Custom label like below:
Custom Label name: CS_ContactIntake_Introduction_English_Info_Text_4
value: Hello. My name is <b class="ny_capitalization">{0}</b> and I am calling from the Colorado Department of Public Health and Environment.
export function reverseTheObject(obj) {
return objReverse(obj);
}
objReverse(object) {
var newObject = {};
var keys = [];
for (var key in object) {
keys.push(key);
.slds-modal__container {
padding: 0;
width: fit-content;
}
.slds-modal__content {
/* padding: 2vh 0 0 0; */
width: fit-content;
height: fit-content;
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.16);