Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>EC_Event__c.EC_Is_Participant_Added__c</members>
<members>EC_Event__c.EC_Event_Completed__c</members>
<members>EC_Event__c.EC_Zoom_Meeting_URL__c</members>
<members>EC_Event__c.EC_Folder_Name__c</members>
<members>EC_Event__c.EC_Is_Presenter_Selected__c</members>
<members>EC_Event__c.EC_Type__c</members>
<members>EC_Event__c.EC_No_Of_Surveys__c</members>
@anilsomasundaran
anilsomasundaran / currentLocation.html
Last active September 27, 2020 18:38
CurrentLocation Component
<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>
<apex:page controller="LexSessionController">
Start{!$Api.Session_ID}End
</apex:page>
<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">
<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>
@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 September 3, 2018 19:21
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
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);
<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>
<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>
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