Skip to content

Instantly share code, notes, and snippets.

View choudharymanish8585's full-sized avatar
💭
Never Settle

Manish Choudhari choudharymanish8585

💭
Never Settle
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="SimpleCalculator">
<apiVersion>45.0</apiVersion>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
import { LightningElement, track } from 'lwc';
export default class SimpleCalculator extends LightningElement {
@track firstNumber;
@track secondNumber;
@track currentResult;
@track operatorUsed;
/**
* This method will be called when either first number or second number is changed
<template>
<lightning-card title="SFDCFacts Calculator" icon-name="standard:formula">
<lightning-layout multiple-rows="true">
<lightning-layout-item size="12" padding="around-small">
<lightning-input type="number" label="First Number" name="firstName" onchange={onNumberChange}></lightning-input>
</lightning-layout-item>
<lightning-layout-item size="12" padding="around-small">
<lightning-input type="number" label="Second Number" name="secondName" onchange={onNumberChange}></lightning-input>
</lightning-layout-item>
<lightning-layout-item size="12" padding="around-small">
/**
* JsonToCSVUtility Class
* This class has helper functiones to convert json string to csv
* @author - Manish Choudhari
* */
public class JsonToCSVUtility {
public static Integer MAX_ROW = 0;
/**
/**
* Controller class for GenericRecordHandler Lightning Component
* Contains method to retrieve objects and records
* @author - Manish Choudhari
* */
public class GenericRecordHandler {
// This method retrieves all object list from Salesforce Org
// You can filter out object list here, as per you use case
@AuraEnabled(cacheable=true)
({
/**
* This function gets object list
* @author - Manish Choudhari
* */
getObjectList : function(component) {
var action = component.get("c.getObjects");
action.setCallback(this,function(response) {
var state = response.getState();
if (state === "SUCCESS") {
({
/**
* This function will be called on page load
* This sets data table columns and also fetches object list
* @author - Manish Choudhari
* */
doInit : function(component, event, helper) {
component.set('v.columns', [
{label: 'Name', fieldName: 'Name', type: 'text'},
{label: 'Action', type: 'button', initialWidth: 135, typeAttributes:
<!-- - **Generic Record Handler Component**
- Use this component to edit any record of any object on the same page
- The component gives you option to only view custom or standard objects or all objects
- You can view your record in read only mode or view mode
- @author - Manish Choudhari
- -->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
access="global"
controller="GenericRecordHandler">
<!-- Init handler, this function will be executed on page load -->
/**
* BusinessDays Class
* Use this class to operate only on business days
* and easily skip weekends and holidays from your logic
* @author - Manish Choudhari
* */
public class BusinessDays
{
public BusinessHours bHours;
/**
({
getAllAccounts : function(component, helper) {
//Calling BaseJS method to call Aura Method
callServer(component, "c.getAccounts",
function(response){
if(response){
component.set("v.data", response);
//Calling showToast method of BaseJS
showToast({
"title": "SUCCESS",