This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Fetching all available attachments in the org | |
List<Attachment> attachments = [Select Body, Id, Name, OwnerId,ParentId From Attachment]; | |
//System.debug('Attachments'+attachments); | |
//Details of content version fields are given in the below link | |
//https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentversion.htm | |
//to map Attachment Id with ContentVersion record | |
Map<Id,ContentVersion> attachmentCVs = new Map<Id,ContentVersion>(); | |
//Map ---> Attachement - Attachment Parent Id | |
Map<Id,Id> attachementParentIds = new Map<Id,Id>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" > | |
<!-- table records are stored on the data attribute --> | |
<aura:attribute name="data" type="List" access="global" /> | |
<!-- init method loads the data attribute values --> | |
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/> | |
<div class="slds-m-around_xx-large"> | |
<h1 class="slds-text-heading--medium">Simple Contacts</h1> | |
<table class="slds-table slds-table_bordered slds-max-medium-table_stacked-horizontal slds-p-horizontal_small" role="grid"> | |
<thead> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
doInit : function(component, event, helper) { | |
//user information | |
var userData = [{"id":1, "name":"Anil", "city":"Ernakulam", "country":"India"}, | |
{"id":2, "name":"Akhil", "city":"Palakkad", "country":"India"}, | |
{"id":3, "name":"Raju", "city":"Wayanad", "country":"India"}, | |
{"id":4, "name":"Mahesh", "city":"Kannur", "country":"India"} | |
]; | |
component.set("v.data",userData); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContactAuraController { | |
@AuraEnabled | |
Public static List<Contact> getContactList(){ | |
//get all contact list | |
List<Contact> conList = [SELECT Id, Name, Account.Name, Phone, Email FROM Contact LIMIT 1]; | |
return conList; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |