Skip to content

Instantly share code, notes, and snippets.

View LokeshSagi's full-sized avatar

Lokesh Sagi LokeshSagi

View GitHub Profile
.error input {
background-color: rgb(255, 255, 255);
border-color: rgb(194, 57, 52);
box-shadow: rgb(194, 57, 52) 0 0 0 1px inset;
background-clip: padding-box;
}
.error {
background-color: rgb(255, 255, 255);
border-color: rgb(194, 57, 52);
@LokeshSagi
LokeshSagi / autoFormatPhone.html
Created March 28, 2020 14:01
Auto format US phone numbers in (xxx) xxx-xxxx format
<template>
<div class="slds-grid slds-wrap">
<div class="slds-col slds-size_1-of-1 slds-large-size_6-of-12 slds-p-horizontal--small">
<div class="slds-form-element slds-p-top_medium">
<label class="slds-form-element__label">Phone number<abbr class="slds-required"
title="required">*</abbr></label>
<div class="slds-form-element__control">
<span onkeypress={keyCheck} onchange={keyCheck}>
<lightning-input-field data-req="required" data-address="phone" data-id="phone" field-name="Phone"
variant="label-hidden"></lightning-input-field>
/* eslint-disable no-useless-escape */
/* eslint-disable radix */
/* eslint-disable consistent-return */
/* eslint-disable no-console */
import ID from '@salesforce/schema/SBQQ__Quote__c.Id';
import { fireEvent } from "c/pubsub";
import NAME_FIELD from '@salesforce/schema/Account.Name';
.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);
export function reverseTheObject(obj) {
return objReverse(obj);
}
objReverse(object) {
var newObject = {};
var keys = [];
for (var key in object) {
keys.push(key);
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.
@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.
@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 / 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 / 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.')