Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
anilsomasundaran / currentLocation.html
Last active Sep 27, 2020
CurrentLocation Component
View currentLocation.html
<lightning-card variant="Narrow" title="Current Location" icon-name="standard:account">
<p class="slds-p-horizontal_small">
<lightning-map map-markers={mapMarkers} zoom-level="10"></lightning-map>
View LexGetSessionIdPage.html
<apex:page controller="LexSessionController">
View contact-list.html
<lightning-card title="My Available Contacts" variant="narrow" icon-name="standard:custom57":wq>
<div class="slds-m-around_medium">
<template for:each={contacts} for:item='contact'>
<lightning-layout vertical-align="center" key={contact.Id} class="slds-m-vertical_medium">
<img src={contact.Picture__c} alt="Profile photo" />
<lightning-layout-item padding="around-small">
<design:component label="Custom Three Column Layout">
<flexipage:region name="left" defaultWidth="SMALL" />
<flexipage:region name="center" defaultWidth="LARGE" />
<flexipage:region name="right" defaultWidth="SMALL" />
global with sharing class AccountManager {
global static Account getAccountById() {
RestRequest request = RestContext.request;
String accountId = request.requestURI.substring(
Account result = [SELECT Name,AccountNumber,Type,BillingAddress
FROM Account
anilsomasundaran / populate_dependent_option_set.js
Created Sep 3, 2018
How to populate the dependent optionset based on a range (child optionset value should maintain a range based on the parent option-set values) in ms crm dynamics 365
View populate_dependent_option_set.js
function filterOptionSet(parentOptionSet, childOptionSet, maxOptionRange) {
//Gets the parent option set control from the CRM page context
var primaryOptionSet = Xrm.Page.getAttribute(parentOptionSet);
//Reads the currently selected option in the parent option set
var selectedOption = primaryOptionSet.getSelectedOption();
//In other way, reads the control of the child option set
//where the dependent values to be populated
var dependentOptionSet = Xrm.Page.ui.controls.get(childOptionSet);
//calls the interal function for filter the child optionset values.
filterDependentOptionSet(selectedOption, dependentOptionSet, maxOptionRange);
View DetectMyDevice.cmp.html
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<lightning:card title="Detect Your Device" class="slds-m-around_large">
<aura:set attribute="actions">
<lightning:button label="Browser Info" onclick="{!c.browse}" />
<div class="slds-p-horizontal_medium">
<aura:if isTrue="{!$Browser.formFactor == 'DESKTOP'}">
<p>You are using Desktop <lightning:icon iconName="utility:desktop" alternativeText="Desktop!" variant="error"/> Browser </p>
View CreateFormComponent1.cmp
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="contactFields" type="String[]" default="Course_Name__c,Course_Fee__c,Course_Start_Date__c,Completion_Date__c,Course_Description__c"/>
onsubmit="{!c.handleSubmit}" />
View switch_with_object.js
sobject obj = null;
switch on obj {
//checks whether the obj is an instance of Account.
//if yes, obj is casted to acc with relevant values
when Account acc {
System.debug('account ' + acc);
//checks whether the obj is an instance of Contact.
//if yes, obj is casted to con with relevant values
View switch.js
String color = 'Y';
//Expression should be any of the allowable type value
switch on color {
when 'V' {
when 'I' {
You can’t perform that action at this time.