Skip to content

Instantly share code, notes, and snippets.

Avatar

anilsomasundaran

View GitHub Profile
@anilsomasundaran
anilsomasundaran / currentLocation.html
Last active Sep 27, 2020
CurrentLocation Component
View currentLocation.html
<template>
<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>
</p>
</lightning-card>
</template>
View LexGetSessionIdPage.html
<apex:page controller="LexSessionController">
Start{!$Api.Session_ID}End
</apex:page>
View contact-list.html
<template>
<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">
<lightning-layout-item>
<img src={contact.Picture__c} alt="Profile photo" />
</lightning-layout-item>
<lightning-layout-item padding="around-small">
View pageLayout_2_7_3.design.html
<design:component label="Custom Three Column Layout">
<flexipage:template>
<flexipage:region name="left" defaultWidth="SMALL" />
<flexipage:region name="center" defaultWidth="LARGE" />
<flexipage:region name="right" defaultWidth="SMALL" />
</flexipage:template>
</design:component>
View AccountManager.java
@RestResource(urlMapping='/Accounts/*')
global with sharing class AccountManager {
@HttpGet
global static Account getAccountById() {
RestRequest request = RestContext.request;
String accountId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Name,AccountNumber,Type,BillingAddress
FROM Account
@anilsomasundaran
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}" />
</aura:set>
<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>
</aura:if>
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"/>
<lightning:recordForm
objectApiName="Course__c"
fields="{!v.contactFields}"
columns="2"
mode="edit"
onsubmit="{!c.handleSubmit}" />
</aura:component>
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' {
System.debug('Violet');
}
when 'I' {
System.debug('Indigo');
}
You can’t perform that action at this time.